I have a server on a well known TCP port to which bunch of clients are connected. Clients use the non blocking option to connect to the server.
When I kill the server process, the client sockets go to CLOSE_WAIT state. Now if I restart the server process and the clients try to connect again, the connect() call seems to block even though its supposed to be non-blocking..
The actual fix might actually be to close the socket when the server dies. But I am trying to understand the current behavior..
- when an existing connection is in CLOSE_WAIT what is preventing a new connection being established ?
- Why is the connect blocking even though is non-blocking option is set ?
This is seen with Linux 2.6.3x kernel..
SO_REUSEADDR
? See stackoverflow.com/questions/775638/… – Basile StarynkevitchSO_REUSEADDR
option? – Basile Starynkevitch