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

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

1 Answers  


Is socket a hardware or software?

0 Answers  


What is a sae socket?

0 Answers  


When will my application receive SIGPIPE?

1 Answers  


Why do I get connection refused when the server is not running?

1 Answers  






Can a socket have multiple ports?

0 Answers  


What is the function of socket?

0 Answers  


How can I bind() to a port number < 1024?

1 Answers  


Why does it take so long to detect that the peer died?

0 Answers  


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

0 Answers  


How are unix domain sockets implemented?

0 Answers  


Why do we need socket programming?

0 Answers  


Categories