Results 1 to 3 of 3
Hi !
In my program I close all TCP sockets before exiting it.
But nevertheless remain the sockets in TIME_WAIT state for a while.
('netstat -na' shows me that.)
What ...
- 10-20-2005 #1Just Joined!
- Join Date
- Oct 2005
- Posts
- 1
Program completed but TCP sockets remain for a while
Hi !
In my program I close all TCP sockets before exiting it.
But nevertheless remain the sockets in TIME_WAIT state for a while.
('netstat -na' shows me that.)
What I want is to ensure that all my TCP sockets get removed
from the system immediately when I stop my process.
Is it possible and how?
- 02-04-2006 #2Just Joined!
- Join Date
- Dec 2005
- Posts
- 2
I can be wrong, but I think, After close connection command executed, Linux OS can't close connection immediately, it must take a short time to close, that is reason when typing 'netstat -na' you saw TIME_WAIT state.
- 02-07-2006 #3Just Joined!
- Join Date
- Apr 2005
- Location
- Romania
- Posts
- 42
The close of socket goes through the TIME_WAIT state. The duration of TIME_WAIT state is twice the maximum segment lifetime (MSL is the maximum amount of time that any given IP datagram can stay in a network). The recommended value of MSL (RFC 1122) is 2 minutes, but Berkeley implementations use 30 seconds. So, the duration of the TIME_WAIT is between 1 and 4 minutes. But in fact you have to take also into consideration the IPv4 TTL field with a maximum value of 255.


Reply With Quote