-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Madhur wrote:
> I am currently developing a tool using Python 2.4.2 which will be used
> as a sink to pump TCP messages. Something is going wrong while closing
> the connection.
> This i confirmed by looking at the ethereal logs, which show proper 3
> way FIN ACK Handshake. But the netstat reports TIME_WAIT state for the
> TCP connection, which is hindering the messages to be pumped later. I
> would like to know the probable cause for the problem.
What problem? According to the RFCs (RFC793, aka STD7), TIME-WAIT is the
standard state that the closing end of a TCP connection should go to, once the
closing handshake is complete.
The RFC says:
TIME-WAIT - represents waiting for enough time to pass to be sure
the remote TCP received the acknowledgment of its connection
termination request.
Your connection is going into TIME-WAIT, just as it should. It will wait for a
2MSL interval, just to make sure that the final ACK has made it to the other
end, completing the close.
/If/ you have need to reuse the TCP port in another connection, you should
establish the *initial* connection with the SO_REUSEADDR socket option. In
this way, sockets will not prevent you from reusing the port while the
original user is in TIME-WAIT state.
HTH
- --
Lew Pitcher
Master Codewright & JOAT-in-training | Registered Linux User #112576
http://pitcher.digitalfreehold.ca/ | GPG public key available by request
- ---------- Slackware - Because I know what I'm doing. ------
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Armoured with GnuPG
iD8DBQFGPR2DagVFX4UWr64RAvvTAJ9ama8VDSgEYrmxFxZFNm ZjeiRuxACfe4sF
1bCh6w5VwK3FPJ6dwqg94LI=
=45DB
-----END PGP SIGNATURE-----