have you actually looked at the comments in that
module yet? It does say exactly what you need to do...
I don't understand the inner workings of the socket or timeoutsocket
modules. On it's face it doesn't make sense that importing
timeoutsocket would magically override the behaviour of socket without
me doing anything else to the socket module. This appears to be what
happens, but it certainly isn't clear to someone that doesn't know how
it works. Here is what timeoutsocket says, "After this module
has been imported, all socket creation goes through this shim. ".
After reading this I was unsure if I needed to install
timeoutsocket.py into the base python distro because, again, it seems
odd that simply dropping timeoutsocket.py into my cwd and importing it
will override the behaviour of the socket module. This didn't say
"exactly what I need to do". It assumed a few things that seemed odd
to me. How does timeoutsocket.py " insert a shim into the socket
module."? What does that mean??? It wasn't clear! In the time it took
you and the other guy to criticize me you could have simply said,
"yeah, just drop it into your cwd and import it".
P.S. - I really do appreciate the help that Benjamin gave.
Here is what timeoutsocket says.
--------------------------------------------------------------------------
"This module enables a timeout mechanism on all TCP connections.
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)
The timeout applies to the socket functions that normally block on
execution: read, write, connect, and accept. If any of these
operations exceeds the specified timeout, the exception Timeout
will be raised.
---------------------------------------------------------------------