[ANNOUNCE] timeoutsocket.py version 1.21
Timothy O'Malley
timo at alum.mit.edu
Wed Dec 5 01:13:22 EST 2001
hola.
I've updated timeoutsocket.py to version 1.21. Fixes include
- Better Windows support.
Error code 10056 now recognized as an indication of a valid connection.
- Better socket emulation.
Added connect_ex() method
- Better data protection.
The read() and readline() methods of a makefile() object no longer
lose data when a timeout occurs. The readlines() method still does.
- Less intrusive when inserting the shim. It no longer modifies
they sys.modules array and no longer modifies every module that
has imported 'socket'.
I would recommend upgrading. I would especially recommend upgrading on
Windows.
Where:
http://www.timo-tasi.org/python/timeoutsocket.py
What is timeoutsocket.py?
This module enables a timeout mechanism on all TCP connections. It
does this by inserting a shim into the socket module. After this module
has been imported, all socket creation goes through this shim. As a
result, every TCP connection will support a timeout.
The beauty of this method is that it immediately and transparently
enables the entire python library to support timeouts on TCP sockets.
As an example, if you wanted to SMTP connections to have a 20 second
timeout:
import timeoutsocket
import smtplib
timeoutsocket.setDefaultSocketTimeout(20)
Good Luck!
TimO
More information about the Python-list
mailing list