What exactly does SO_REUSEADDR do?
Answer / chaitanya
This socket option tells the kernel that even if this port is busy (in the TIME_WAIT state), go ahead and reuse it anyway. If it is busy, but with another state, you will still get an address already in use error. It is useful if your server has been shut down, and then restarted right away while sockets are still active on its port. You should be aware that if any unexpected data comes in, it may confuse your server, but while this is possible, it is not likely.
| Is This Answer Correct ? | 0 Yes | 0 No |
How to find other end of unix socket connection?
How do I properly close a socket?
What is socket address?
How do I get the port number for a given service?
How often should I re-transmit un-acknowleged messages?
How can I listen on more than one port at a time?
How can I tell when a socket is closed on the other end?
Why does the sockets buffer fill up sooner than expected?
What is the difference between connected and unconnected sockets?
How can I set the timeout for the connect() system call?
Can a single socket port be used for multiple applications?
of the socket? Does doing a connect() call affect the receive behaviour?