Why do not my sockets close?

Answer Posted / chaitanya

When you issue the close() system call, you are closing your interface to the socket, not the socket itself. It is up to the kernel to close the socket. Sometimes, for really technical reasons, the socket is kept alive for a few minutes after you close it. It is normal, for example for the socket to go into a TIME_WAIT state, on the server side, for a few minutes. People have reported ranges from 20 seconds to 4 minutes to me. The official standard says that it should be 4 minutes. On my Linux system it is about 2 minutes. This is explained in great detail in ``2.7 Please explain the TIME_WAIT state.''.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

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

1103


What is a socket connection?

673


Is tcp or unix socket faster?

615


How many sockets can a port have?

643


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 a socket set used for?

687


Can a socket have multiple ports?

640


Where is the socket located?

638


What is the difference between SO_REUSEADDR and SO_REUSEPORT?

1553


What is sae socket?

595


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

1112


What is the function of socket?

665


What is a deep well socket?

685


What is the difference between a socket and a port?

622


How do unix sockets work?

617