bind address doubt
- Hi folks,
I have a server-client application.
I do the following steps
1. Start the server.
2. Start the client.
3.Abort the server(which means Ctrl-C), but client is
4. Next i restart the server , it gives bind address
already in use.
Now i do a netstat, and i find that on the server
side, the socket is in FIN_WAIT2 state.
Client side is in CLOSE_WAIT state.
Why does'nt the server go in TIME_WAIT state waiting
for the FIN from the client to come to server.
Instead the server goes to CLOSE state, why is that?
For a better Internet experience
AFAIK, when the server calls close() on a TCP socket,
the TCP layer waits for some time before actually
closing the socket and freeing the port for re-use. I
presume this is done so that any pending ACK's are
recieved. I vaguely know that there might be a way to
over-ride this. The Unix Socket FAQ
(http://www.ibrado.com/sock-faq/) has some information
on this(look under the "Please explain TIME_WAIT"
A kludge sort of way to avoid this problem would be to
have the server keep trying to get the port and output
a message like "Now accepting" when it succeeds. The
client should be started only after you see this
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.