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 |
Can a socket have multiple ports?
Why do I get EPROTO from read()?
Explain the TIME_WAIT state.
How do I convert a string into an internet address?
When will my application receive SIGPIPE?
What are the pros/cons of select(), non-blocking I/O and SIGIO?
How can I put a timeout on connect()?
What is a socket set used for?
How can I bind() to a port number < 1024?
Why sockets are used?
What is a deep well socket?
Why do not my sockets close?