Loco
07-26-2002, 10:50 PM
4.2 - Why don't my sockets close?
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..
From: Erik landry
Also, the kernel will NOT shutdown a socket on a close(2) if another process (e.g., a child that inherited the file descriptor) still has the socket open. For more information, see shutdown(2) or 2.2 When should I use shutdown()
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..
From: Erik landry
Also, the kernel will NOT shutdown a socket on a close(2) if another process (e.g., a child that inherited the file descriptor) still has the socket open. For more information, see shutdown(2) or 2.2 When should I use shutdown()