What exactly does SO_REUSEADDR do?

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is a socket a file?

611


How to find other end of unix socket connection?

657


What is socket programming in java?

625


Why do we need sockets?

603


What are the types of sockets?

664


What is a socket address?

680


What is the purpose of socket?

665


How can I set the timeout for the connect() system call?

1250


How can I tell when a socket is closed on the other end?

1112


What is the difference between read() and recv()?

1717


Why does the sockets buffer fill up sooner than expected?

1118


Whats the difference between select() and poll()?

1371


system choose one for me on the connect() call? Should I bind() a port number in my client program, or let the?

1297


What is af_inet in socket?

622


What pieces of information make up a socket?

723