Re: How to catch socket timeout?
On Wed, 24 Sep 2003, Michael Hudson wrote:
[color=blue]
> Paul <paul@oz.net> writes:
>[color=green]
> > What's the best way to do this under Python 2.1?
> > I believe socket.timeout was a 2.3 feature.
> > Wrap it in threads?[/color]
>
> There's Tim O'Malley's timeoutsocket.p y (google for it), which was the
> inspiration for the feature in 2.3 (though I don't think any code from
> there actually survived).[/color]
I can't get the timeoutsocket module to work on my Redhat Linux! (The
timeout works fine on Windows 2000.) I'm running Python 2.2.2.
Here's the test code:
import timeoutsocket
timeoutsocket.s etDefaultSocket Timeout(1)
s = timeoutsocket.s ocket(timeoutso cket.AF_INET, timeoutsocket.S OCK_STREAM)
s.connect(("www .google.com", 80))
s.close()
Any ideas?
/Mickel G.
On Wed, 24 Sep 2003, Michael Hudson wrote:
[color=blue]
> Paul <paul@oz.net> writes:
>[color=green]
> > What's the best way to do this under Python 2.1?
> > I believe socket.timeout was a 2.3 feature.
> > Wrap it in threads?[/color]
>
> There's Tim O'Malley's timeoutsocket.p y (google for it), which was the
> inspiration for the feature in 2.3 (though I don't think any code from
> there actually survived).[/color]
I can't get the timeoutsocket module to work on my Redhat Linux! (The
timeout works fine on Windows 2000.) I'm running Python 2.2.2.
Here's the test code:
import timeoutsocket
timeoutsocket.s etDefaultSocket Timeout(1)
s = timeoutsocket.s ocket(timeoutso cket.AF_INET, timeoutsocket.S OCK_STREAM)
s.connect(("www .google.com", 80))
s.close()
Any ideas?
/Mickel G.
Comment