On Thu, 3 Jan 2008, sudha kar wrote: > > Hi All, > I am using lwip raw api's on Threadx RTOS. Our requirement is we need to > start and stop tcp service on demand. > > Tcp service is a interface for the clients to access the low level api's from > the server. I am spawning a thread whenever user requests for service start > and killing whenever user requests for stop the service, in that thread I > wrote the code for the server. > > If I continously stop and start the service for about 2 hours and > parallely some 4 to 6 clients are continously trying to access the server my > bind is failing, from that point I couldn't able to start the TCP service > even though I enabled reuse port option. > > Can anybody tell me the problem. > Appreciate the help. >
Hi Sudhar: The TCP state machine will transition to CLOSING state and then wait for 2 x WAIT_TIME specified. Please see http://penguin.dcs.bbk.ac.uk/academic/networks/transport-layer/tcp/connection-fsm.gif You need to do a select() call to check if the descriptor is valid. If yes, you can attempt to re-use, if not, then close() the socket. thanks Saifi.

