Why do not my sockets close?



Why do not my sockets close?..

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

More Unix Socket Programming Interview Questions

Where is the socket located?

0 Answers  


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

0 Answers  


How do Sockets Work?

1 Answers  


Can multiple sockets use the same port?

0 Answers  


How many sockets can a cpu have?

0 Answers  






What is the difference between close() and shutdown()?

1 Answers  


How can I force a socket to send the data in its buffer?

0 Answers  


Explain the TIME_WAIT state.

1 Answers  


What is sae socket?

0 Answers  


How should I choose a port number for my server?

1 Answers  


Is a socket a file?

0 Answers  


What is a sae socket?

0 Answers  


Categories