Marty, Thanks for answering. Yes you put me on the right track.
Yes the it was the client PCB that was in TIME_WAIT. Firstly I had not understood that I should call the tcp_tmr() for lwip timer functions to work. Secondly I figured out that when the TIME_WAIT for the PCB has elapsed it is removed and I have to create a new PCB for next connection (right?). What I'm doing now is: create a new PCB through tcp_new(); Than setting up an exception handler through tcp_err(); Opening a connection using tcp_connect(); In the connect accept callback function I send some data with tcp_write(....); tcp_output(); In the data sent callback function I close to socket using tcp_close();. Then I initiate a time event that will start the process all over again after a few seconds. Making my little test app open the socket sending some data closing the socket over and over again. >From what I can see from the lwip code this should impose no problem since it looks like as if there is no room for any new PCB the lwip seems to find and prematurely kill the oldest PCB with TIME_WATE state. Is this a correct approach? Best regards, Mats Mats The behavior of sockets, even after being closed, they stick around for a little while in TIME_WAIT state. This allows acks to complete, etc. You cannot re-open that socket until that expires. For more details, Google TIME_WAIT. If you wait a couple of minutes, can you then reconnect? If the test server is Windows, run TCPView, cuz that shows sockets that are still in TIME_WAIT state. Hope this helps! Marty -- View this message in context: http://old.nabble.com/lwip-raw-TCP-client.-tp33956119p33962745.html Sent from the lwip-users mailing list archive at Nabble.com. _______________________________________________ lwip-users mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/lwip-users
