cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Voyager
Voyager
3,616 Views
Registered: ‎10-25-2012

Why does the connection can only be build several times in LwIP echo server application?

When I run the LwIP echo server application through JTAG, I found a phenomenon that is: the connection can be built only several times instead of infinite. Similarilty, after you make a connection, the data can be echo several times instead of infinite. I try to find whether there is "counter" inside the code which may limit the time, but I didn't find it. If it is not caused by "counter", I guess it may be caused by "timer". Is anybody confront the similar thing like me and can explain the reason?

 

Thanks very much.

0 Kudos
4 Replies
Highlighted
Voyager
Voyager
3,608 Views
Registered: ‎02-10-2012

Re: Why does the connection can only be build several times in LwIP echo server application?

What do you mean by " the connection can be built only several times " ?
0 Kudos
Highlighted
Voyager
Voyager
3,602 Views
Registered: ‎10-25-2012

Re: Why does the connection can only be build several times in LwIP echo server application?

Hi, I mean after I implement the application in hardware, I can use the terminal to make connection, close connection. After several times (e.g. 10 pairs) "make/close", then I can't make connection anymore.
0 Kudos
Highlighted
Voyager
Voyager
3,595 Views
Registered: ‎02-10-2012

Re: Why does the connection can only be build several times in LwIP echo server application?

How exactly are you closing the connection ? It might be possible that your connection closing mechanism is not correct. That way your older connections are still active! 

 

So the primary reason I suspect is that you are running out of memory as your older pcb's are not freed up correectly! I would check the debug messages. Turn on lwip statistics and the debug messages from the lwip library settings in the BSP. 

 

Also note there is a parameter called TCP_DEFAULT_LISTEN_BACKLOG which is set to FF by default. This makes it possible to have a limited number of simultanious connections.

 

The connection id in the tcp_accept callback is keeping track of the number of connections accepted! that is why it is declared static.  

0 Kudos
Highlighted
Voyager
Voyager
3,575 Views
Registered: ‎10-25-2012

Re: Why does the connection can only be build several times in LwIP echo server application?

I use terminal to send and receive data. There is a button in the terminal GUI, to connect or disconnect. I didn't edit the application about allocate/deallocate the PCB. However, after I checked the code, I didn't see any commands look like to free up the PCB. I don't understand whether PCB free up is unnecessary or is needed but be ignored in LwIP echo server application?

You mentioned "Turn on lwip statistics and the debug messages from the lwip library settings in the BSP", I am not very familar how to do that?

Thanks very much.
0 Kudos