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 |
After the chroot(), calls to socket() are failing. Why?
How to find other end of unix socket connection?
How are unix domain sockets implemented?
How many sockets can a port have?
What are Sockets?
Why does connect() succeed even before my server did an accept()?
What is a socket file?
What exactly does SO_REUSEADDR do?
Can multiple sockets use the same port?
What are socket exceptions? What is out-of-band data?
What is the difference between close() and shutdown()?
Why do I keep getting EINTR from the socket calls?