This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Incorporate timeoutsocket.py into core
Type: enhancement Stage:
Components: Library (Lib) Versions:
process
Status: closed Resolution: duplicate
Dependencies: Superseder:
Assigned To: gvanrossum Nosy List: fdrake, gvanrossum, mgilfix, skip.montanaro
Priority: normal Keywords:

Created on 2001-08-31 05:48 by skip.montanaro, last changed 2022-04-10 16:04 by admin. This issue is now closed.

Messages (11)
msg6285 - (view) Author: Skip Montanaro (skip.montanaro) * (Python triager) Date: 2001-08-31 05:48
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
msg6286 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2001-08-31 13:10
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?
msg6287 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2001-09-05 18:26
Logged In: YES 
user_id=6380

Skip, want to work on this? If not, please unassign it.
msg6288 - (view) Author: Skip Montanaro (skip.montanaro) * (Python triager) Date: 2001-09-05 20:46
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...
msg6289 - (view) Author: Michael Gilfix (mgilfix) Date: 2002-04-17 05:22
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.
msg6290 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2002-04-17 12:14
Logged In: YES 
user_id=6380

Bernard Yue is considering to tackle this. See the thread in
python-dev starting at
http://mail.python.org/pipermail/python-dev/2002-April/023278.html
Maybe you two can work on this together?
msg6291 - (view) Author: Skip Montanaro (skip.montanaro) * (Python triager) Date: 2002-04-17 15:32
Logged In: YES 
user_id=44345

Check the python-dev mailing list archive for the past few
days.  There is an active thread about this topic.
msg6292 - (view) Author: Michael Gilfix (mgilfix) Date: 2002-04-23 03:56
Logged In: YES 
user_id=116038

For the record, I have a patch. I'm coordinating with
Bernard Yue for some preliminary testing and it'll added
into the patch tracker shortly.
msg6293 - (view) Author: Michael Gilfix (mgilfix) Date: 2002-05-12 12:12
Logged In: YES 
user_id=116038

A patch for this now exists in the SF tracker: #555085.
msg6294 - (view) Author: Fred Drake (fdrake) (Python committer) Date: 2002-06-17 14:56
Logged In: YES 
user_id=3066

I think this is done and can be closed now, but Guido's been
working on this and knows the current status.
msg6295 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2002-06-17 14:59
Logged In: YES 
user_id=6380

Closing. Further discussion at the corresponding patch.
History
Date User Action Args
2022-04-10 16:04:23adminsetgithub: 35084
2001-08-31 05:48:27skip.montanarocreate