RedCollarPanda | 27 Aug 09:56 2014

Maximizing throughput

I have a Debian x64 machine and want to make throughput as fast as library
I have application with netcon and application with sockets, but it works
really slow. 

I send a char buf[1024]  for about 1 048 576 times  and it takes more than
1000 seconds ...

this is my lwipopts.h file.

#define LWIP_DEBUG 0
#define LWIP_RAW 0
#define TCP_MSS 1460
#define TCP_WND 65535
#define TCP_SND_BUF 65535
#define TCP_OVERSIZE 1460

#define TCP_SND_QUEUELEN 256
#define PBUF_POOL_BUFSIZE 2048
#define TCP_NODELAY 1

how can I make connection faster?

View this message in context:
Sent from the lwip-users mailing list archive at
(Continue reading) | 27 Aug 09:05 2014

packets dropped ,no space: which PCB?

*My LwIP application desc.:* Lwip server receives TCP packets and starts
processing from one remote client.
*the problem :* after processing only *255 *packets (I've set counter in
recv. callback) pcb returns 'packet dropped, no space' and stops working.
while program is alive and other tasks (like xemacif_input()) are running.
*Question:* How to determine which PCB the error is returned by?
  How to flush it or restart it?
  any Ideas...
Thanks in advance. 

View this message in context:
Sent from the lwip-users mailing list archive at
Tomas Daujotas | 26 Aug 18:17 2014

IGMP time between membership messages

I have faced an issue, a managed switch, which sends a General Query IGMP message to the network asking for multicast devices to identify the streams they want.
Apparently LwIP sends IGMP messages around 120 seconds interval, which usually works with most of the switches, however since the messages are sent depending on LwIP timers, they get timeout as they are not synchronized to the switch requests.
The switch sends a General Query message every 125 seconds as per RFC2236 section 8.2. It also expects the device to reply within 45 seconds (this is a non-changeable setting in the switch parameters). The standard section 8.3 defines a recommended default value of 10 seconds.
Since LwIP generates the report message every +/-120 seconds and it doesn't respond to General Queries, I would like to do a workaround this issue by sending the messages every 40 seconds instead of 120 seconds. Could someone advise where should I look for this change?

My system use NO_SYS_NO_TIMERS = 1.
I have a single timer firing up every 250ms (and I don't have any other available timers), where I call tcp_tmr() and igmp_tmr().
My IGMP_TMR_INTERVAL is set to 250.

Maybe I am misinterpretting LwIP IGMP messaging idea, but seems like it works as I've described.

Thank you.

Tomas Daujotas
lwip-users mailing list
Vincent Cui | 23 Aug 04:46 2014

Re: demo web refresh down



I define  following to use system malloc and free

#define MEM_LIBC_MALLOC                 1

#define MEMP_MEM_MALLOC                 1


I found that the malloc memory is not free on time, so malloc failure in new request coming.


It seems to need some protect those . Am I right ?



Vincent Cui
Firmware Engineer Leader

Room1106, Building A, New Caohejing Business Centre, No.391, Guiping Road, Xuhui District, Shanghai, P.R.China
T: +86 21 34612525, M: +86 13482482211
P please consider the environment before printing this email

This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to which they are addressed.  If you have received this e-mail in error, please notify the sender immediately and then delete it.  If you are not the intended recipient, you must not use, disclose or distribute this e-mail without the author's prior permission. We have taken precautions to minimize the risk of transmitting software viruses, but we advise you to carry out your own virus checks on any attachment to this message.  We cannot accept liability for any loss or damage caused by software viruses.  Any views and/or opinions expressed in this e-mail are of the author only and do not necessarily represent the views of Enlogic.

From: Vincent Cui
Sent: 2014
823 9:50
To: lwip-users <at>
Subject: demo web refresh down




I use LPCXPRESSO to develop a simple demo server with NETCONN api on LPC1769

If the demo server refresh itself per 3 second, it works well.

If I refresh it by press F5 frequencely, it halt and can’t connect to host..


Who know the reason ?



lwip-users mailing list
RedCollarPanda | 22 Aug 11:12 2014

LWIP packet loss or else

Good day! 
I have lwip library test application (tcp_echo) on my machine and a netcat
server on virtual box.

ILWP tcp_echo was changed to be a client. now it looks like:

static void 
tcpecho_thread(void *arg)
	err_t err;
  while (1) {
      struct netconn *server_con;
      ip_addr_t ipaddr_con;
      IP4_ADDR(&ipaddr_con, 172, 17, 9, 71);
      server_con = netconn_new(NETCONN_TCP);

       bool flag = tcp_nagle_disabled(server_con->pcb.tcp);
       std::cout << "Nagle alg IS " << flag  << std::cout;
	flag = tcp_nagle_disabled(server_con->pcb.tcp);
        std::cout << "Nagle alg_after IS " << flag  << std::cout;
      netconn_bind(server_con, NULL, 8);
      err = netconn_connect(server_con, &ipaddr_con, 16958);
      if (err == ERR_OK) {
        while(1) {
        printf("While 1\n");
         void *data  = "lool\n"; ;
          u16_t len;
         len = sizeof("lool\n");
         err = netconn_write(server_con, data, len, NETCONN_COPY);
      } else {
        printf("tcpecho: netconn_connect: error \"%s\"\n",
        /* netconn_close(newconn);*/


Now the trouble is - when I only WRITE to netcat - all is fine and works
great, but when I try to write from netcat to lwip several messages  I get
errors . If I send messages too often (or too fast) I get some kind of
deadlock - 

lwip sends  <at> retransmit <at>  packets and w8s for packets from netcat. Netcat does
the same.

First I thought that the problem is in Nagle's algorithm as you see - I
turned it of... (checked it).

so what's the problem? Why the the stack doesn't respond in proper time?
here is a wireshark log file

lwip.lwip <>  

View this message in context:
Sent from the lwip-users mailing list archive at
Avi | 21 Aug 17:16 2014

Opening a TCP session, using LwIp Rev 1.4.1


I am using LwIp Rev 1.4.1, on an an embeded system, and trying to open a TCP
session against Jpref TCP test tool, running on PC, and the session is not

*The source code on my system, for opening the TCP session:*

#define TCP_TEST_PORT		( 5001 )

struct netconn *TcpTestListener, *pxNewConnection;
uint status = 0;
struct netbuf *pxRxBuffer;
char *pcRxString;
unsigned short usLength;

/* Create a new tcp connection handle */
TcpTestListener = netconn_new( NETCONN_TCP );
ZR_ASSERT(TcpTestListener != NULL);
status = netconn_bind(TcpTestListener, IP_ADDR_ANY, TCP_TEST_PORT );
status = netconn_listen( TcpTestListener );

/* Loop forever */
for( ;; )
	/* Wait for connection. */
	status = netconn_accept(TcpTestListener, &pxNewConnection);

	if((status == TX_SUCCESS) && (pxNewConnection != NULL))
		/* Service connection. */

		/* We expect to immediately get data. */
		status = netconn_recv( pxNewConnection, &pxRxBuffer );
		ZR_ASSERT(status == TX_SUCCESS);

		if( pxRxBuffer != NULL )
			/* Where is the data? */
			status = netbuf_data( pxRxBuffer, (void **)&pcRxString, &usLength );
			ZR_ASSERT(status == TX_SUCCESS);

			/* Write back the data */
			status = netconn_write(pxNewConnection, pcRxString, (u16_t)usLength,
			ZR_ASSERT(status == TX_SUCCESS);

	    		netbuf_delete( pxRxBuffer );
		status = netconn_close( pxNewConnection );
		ZR_ASSERT(status == TX_SUCCESS);

		while( netconn_delete( pxNewConnection ) != ERR_OK )

Do you about a problem when working against the Jpref tool, or you see a
problem in my code ?


View this message in context:
Sent from the lwip-users mailing list archive at
tm264 | 20 Aug 14:36 2014

mem alignment issue when updating to Rev 1.4.1


When updating lwip from 1.3.2 to 1.4.1 I see some asserts checking for alignment equal 4. They are hard coded.
Does this mean lwip can only be used with MEM_ALIGNMENT equal 4  from this Release on?

Regards Thomas
Alain Mouette | 19 Aug 00:33 2014

Simulatng an Arduino interface

Hi, I have do do something a little odd, and I would like to have your 
advice about it and to know if anyone has ever seen anything like it

I need to simulate the interface available on the Arduino (with the 
WizChip), I believe that wiht such an interface I could use some 
software develloped for the Arduino platform. Please help me pointing to 
a better direction.

The API interface is like this:
EthernetServer TelnetServer1(ETH_PORT_TELNET); // Static object, defines 
the listening port
EthernetClient TelnetClient=NULL;              // used when connected
void setup() {
void loop(){
   if (!TelnetClient){                             // verify if a 
connection is already open
     if ((TelnetClient=TelnetServer1.available())==NULL){
     }else{// Newconnection
       TelnetClient.println(F("Conectado - BonsEletrons"));
   if (TelnetClient.connected()){
     while (TelnetClient.available())
       uint8_t c =;            // Get one char at a time
       // ... do something
       TelnetClient.println("Erro!");              // send results
   }else{                           // nao est mais conectado
     TelnetClient.stop(); // close the connection:
Thanks for any suggestion
Dominik Wybrańczyk | 18 Aug 10:46 2014

TCP send problem

Hello, my name is Dominik and this is my first post to lwip mailing list. I am working on stm32f4 IOT project where I want to use RAW lwip. I am basing on standalone tcp echo example made for STM32F4DIS-BB (Embest). I have already designed some drivers, and they are working great (like connection accpet, connection close, receiving handler, parser etc). But I have some problems with sending data. Everything works well when I am sending messages up to 38B, but if I send more than they are corrupted. 

Here is how it works:
My device is server, and I connect as clinet with my PC. I am sending some data from PC to my device. Than when I have received some information form PC, I parse it and want to respond with another data.
Firstly I am checking "freespace" in sending container by using tbp_sndbuf() like:
freespace = tcp_sndbuf(tpcb);
Usually there are a lot of space (like 2500B, but I also have handler for the situation when there are more data to send than container can handle...) so after that I am passing message to tcp_write like this:
wr_err = tcp_write(tpcb,&buff[flag], sendLen,0);
Variable wr_err is always 0, so "mem write" is OK. After that to make sure the message will be send now I call:

Sadly, the information I am receivng on PC is wrong every time when I am sending more than 38B. Usually its shorter and the message is like: 
corrupted_data + SMALL_PART_THAT_IS_OK + other_corrupted_data.

To be honest I am not getting the idea with the tcp_send() callback, but I assume that I dont need it in this simple example.

I am using lwip_v1.3.2 as in example. Should I update it?

What should I look at? Am I doing something wrong?

Kind Regards
lwip-users mailing list
markus.forrer | 17 Aug 09:39 2014

contrib 1.4: web server doesn't work

I'm using lwip 1.4.1 successful in a target project with PowerPC.
Now I'm trying to use lwip in the simulation project for Windows computers. For this I tested the contrib sample project together with httpserver-netconn.
If I connect to the http server with a browser from a second computer, I can see in Wireshark the http request AND http response. Unfortunately the response will not loaded in the browser.
The firewalls are switched off on both computers (server and client).
Any hints?
Thank you very much for your support!
lwip-users mailing list
Mark Lvov | 15 Aug 23:26 2014

Split DNS for multihomed setup


I am using raw API, my system has two distinct network interfaces and
there is a requirement, that (TCP) connections to certain remote
addresses are made through certain network interfaces.

Furtermore, the destinations, that we must connect to might be
specified as domain names, that obviously need resolving. The problem
is, certain destinations must only be resolved via DNS queries, that
are made through a particular network interface. For example, consider
a situation, when we have a PPP netif and an ethernet netif (that is
on a "local" network) and we need to connect to "foo.local" via
ethernet netif. We obviously must make sure, that the DNS query is
made through the ethernet interface. Hope, that makes sense.

Now, I've looked through the DNS implementation and I see that there
are basically two obstacles:
* there is no way to specify, which interface the queries should go
through (the pcb is bound to IP_ADDR_ANY without any way to override
* the "resolver cache" (dns_table) obviously does not consider which
interface the entry belongs to

I am intentionally mentioning "interface" all throughout, but it can
be substituted for "source address", since those are equivalent in
this context.

What is the best way to tackle this problem? Perhaps I should attempt
to patch the dns implementation to add the "source address" argument
to the relevant functions and make the entries dns_table aware of the
source address of the query (falling back to IP_ADDR_ANY if source
address is not specified)? Is there any other way to do this?