Why do Windows sockets break after exactly 4 minutes?
Juergen Gather
sid at claudius87.plusserver.de
Fri Mar 22 20:08:20 EST 2002
GT> sent message at Fri Mar 22 14:14:01 2002
GT> socket exception caught at Fri Mar 22 14:18:01 2002
GT> Traceback (most recent call last):
GT> File "D:\junk\SocketTimeoutTest\client.py", line 13, in ?
GT> data = s.recv(1024)
GT> File "<string>", line 1, in recv
GT> socket.error: (10054, 'Connection reset by peer')
GT> When I use a time shorter than 4 minutes in the time.sleep(), the output
GT> from client.py looks like:
GT> sent message at Fri Mar 22 14:20:43 2002
GT> Received 15 bytes: Goodbye, world!
GT> closed socket at Fri Mar 22 14:20:58 2002
GT> So something is breaking the socket after 4 minutes.
GT> I should note that this is on a Windows NT 4.0 SP6 box. Perhaps I'll try
GT> Win2K to see if there's a difference there.
I tried it under XP and there is exactly the same behaviour you
describe above - only that its only 2 minutes (exact again!) until the
socket breaks.
Under FreeBSD there seems to be no such problem. I also tried to
put client and server on different machines and everything is ok with
server on the XP-Box and client on BSD while server on BSD and client
on XP is breaking the socket after the "magic" 2 minutes.
I can't tell if BSD or Windows behaviour is justified but it sure is
irritating if code that looks platform independent (at least it does
for me) decides not to be ;-).
I suspect there should be some registry entry under Windows influencing
this behaviour - any ideas ?
Juergen
More information about the Python-list
mailing list