[Python-bugs-list] [ python-Bugs-457114 ] Incorporate timeoutsocket.py into core
noreply@sourceforge.net
noreply@sourceforge.net
Tue, 16 Apr 2002 22:22:44 -0700
Bugs item #457114, was opened at 2001-08-31 01:48
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=457114&group_id=5470
Category: Python Library
Group: Feature Request
Status: Open
Resolution: None
Priority: 5
Submitted By: Skip Montanaro (montanaro)
Assigned to: Nobody/Anonymous (nobody)
Summary: Incorporate timeoutsocket.py into core
Initial Comment:
I was responding to a question on c.l.py earlier about
urllib hanging and was reminded of Tim O'Malley's
timeoutsocket.py. It's a shim above socket that allows
you to set timeouts on any TCP connections. Back in
January, Jeff Bauer suggested in c.l.py that it be
included in the core. I agree that it provides useful
extra functionality beyond the current socket
implementation and would like it to be considered for
addition to the standard distribution. Here's a
pointer:
http://www.timo-tasi.org/python/timeoutsocket.py
Here's how you use it:
import timeoutsocket
import httplib
timeoutsocket.setDefaultSocketTimeout(20)
# at this point any sockets created
# will have a 20-second timeout
h = httplib.HTTP("www.python.org")
Pretty simple, huh?
Skip
----------------------------------------------------------------------
Comment By: Michael Gilfix (mgilfix)
Date: 2002-04-17 01:22
Message:
Logged In: YES
user_id=116038
I'd be interested in integrating the two modules if no one
has tackled this yet. Seems like it would make a cool
feature.
I'm a little unclear on where you think the best integration
(and I'm a little new to the interpreter source :) ) point
would be - in the python module interface socket.py or the
lower level c interface socketmodule.c.
----------------------------------------------------------------------
Comment By: Skip Montanaro (montanaro)
Date: 2001-09-05 16:46
Message:
Logged In: YES
user_id=44345
While the offer is tempting, I almost certainly don't
understand the various bits associated with sockets and
don't have the time to learn them, so I'm unassigning.
Hopefully someone else will pick it up for 2.3...
----------------------------------------------------------------------
Comment By: Guido van Rossum (gvanrossum)
Date: 2001-09-05 14:26
Message:
Logged In: YES
user_id=6380
Skip, want to work on this? If not, please unassign it.
----------------------------------------------------------------------
Comment By: Guido van Rossum (gvanrossum)
Date: 2001-08-31 09:10
Message:
Logged In: YES
user_id=6380
I like this idea, but don't think this exact implementation
belongs in the standard library. The hacks deployed to
"install" the special effect are a bit fragile, e.g.
consider "import socket as foo"; and they shouldn't be
necessary.
When integrated into the standard library, it should
probably become a standard feature of the socket object.
Note that on Windows, socket.socket is already a shim on top
of _socket.socket, so that would be a convenient starting
point.
Patch anyone?
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=457114&group_id=5470