Hi Namita, Thanks for the response. My server is running on Firmware (Storage Box), so I don't have chance to debug (like netstat). I am already using 'SO_REUSEPORT', but it didn't solved my problem. Is there any difference between 'SO_REUSEADDR'. and 'SO_REUSEPORT'.
-- Regards Sudhakara Rao Murala On Jan 5, 2008 12:02 PM, Namita Iyer <[EMAIL PROTECTED]> wrote: > 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. > > > > -- > > Regards > > Sudhakara Rao Murala > > Vedams Software Solutions. > > Hi Sudhakara, > > When a server that has connected clients is killed, the port does not > become available immediately. > There is a time lag before it is available (typically known as the > TIME_WAIT state or 2MSL wait state). > > If you run 'netstat -a' you will see your port in timed wait state. > > One brute-force method to solve the problem is to create the socket with > the option 'SO_REUSEADDR'. > However, the right approach would be to send a signal to the server and > handle the signal to > close the connections gracefully. > > Namita > > >

