Problem with Closing TCP connection

malkarouri at gmail.com malkarouri at gmail.com
Sat May 5 07:57:31 EDT 2007


On 5 May, 12:18, Madhur <madhurr... at gmail.com> wrote:
[...]
> as a sink to pump TCP messages. During which i have observed that the
> TCP close interface provided by Python is not 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 whether the problem exists Python close and is
> there is turnaround? to the mentioned problem.

IIRC, this is normal operation of TCP connections. A very short
explanation is here (http://www.unixguide.net/network/socketfaq/
2.7.shtml).
So it is not a problem of Python.
I don't know exactly what you want to do, but I suggest you look at
one of the following options:
- Either get IP messages and filter them, same way as ethereal.
Probably complicated coding.
- Depending on your problem, you may try opening the TCP socket in
Python using the SO_REUSEADDR option.

Regards,
k




More information about the Python-list mailing list