Problem with TCP Connection Close

Problem with TCP Connection Close

Post by Madhu » Sun, 06 May 2007 20:23:46



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.
 
 
 

Problem with TCP Connection Close

Post by Lew Pitche » Mon, 07 May 2007 09:12:52


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


> 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

iD8DBQFGPR2DagVFX4UWr64RAvvTAJ9ama8VDSgEYrmxFxZFNmZjeiRuxACfe4sF
1bCh6w5VwK3FPJ6dwqg94LI=
=45DB
-----END PGP SIGNATURE-----

 
 
 

Problem with TCP Connection Close

Post by Kalyan Manchikant » Tue, 08 May 2007 23:23:18



Quote:> 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.

As long as the connection stays in TIME_WAIT for  <= 2 MSL ( max.
segment life time)..it is considered normal behavior..

Kalyan

 
 
 

1. How can i detect that a client has closed a TCP-stream connection ???

Hi,
i have a client-server communication via TCP-stream socket
connections.
When the client closes its socket, and the server still sends data via
the invalid socket descriptor, the write does not return an error, but
it seems to exit the server programm ?!?!?
How can the server detect, that the client has closed its socket ????
I still repeat: the write does not return an error !!!

Thanx very very much,

J. Riedel


2. Newbie needs help connecting a Sun Ultra 5, running Solaris 8, to the Internet.

3. Help! TCP connection closed by foreign host

4. question about tcsetpgrp()

5. Netscape server not closing TCP connection

6. recognizing hd on IBM PS/ValuePoint

7. HELP: reading from a closed TCP connection

8. Does the DEBIAN linux distribution...

9. How do you flush wierd CLOSE-state TCP connections?

10. Closing Bad TCP Connections

11. How can I close an active TCP connection?

12. Closing a TCP connection

13. How can I know that Connection closed (TCP)