How come I get address already in use from bind()?

Answer Posted / chaitanya

You get this when the address is already in use. (Oh, you figured that much out?) The most common reason for this is that you have stopped your server, and then re-started it right away. The sockets that were used by the first incarnation of the server are still active. This is further explained in ``2.7 Please explain the TIME_WAIT state.'', and ``2.5 How do I properly close a socket?''.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

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

1114


What is the difference between a socket and a port?

467


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

1165


What are the pros/cons of select(), non-blocking I/O and SIGIO?

978


What is af_inet in socket?

477






Are sockets files?

509


How does unix socket work?

508


Is socket a hardware or software?

505


Can multiple clients connect to same socket?

518


Can multiple sockets use the same port?

496


Where is the socket located?

476


What does af mean in sockets?

524


How is a socket created?

511


Are unix sockets faster than tcp?

496


Can a socket have multiple ports?

506