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 |
What is the difference between a socket and a port?
Is a socket a file?
How can I put a timeout on connect()?
What exactly is a socket?
Is tcp or unix socket faster?
What is a socket connection?
How do I use TCP_NODELAY?
Whats the difference between select() and poll()?
What is the difference between read() and recv()?
How can I read ICMP errors from connected UDP sockets?
How does unix socket work?
How can I listen on more than one port at a time?