[Tutor] socket timeout

Sander Sweers sander.sweers at gmail.com
Fri Nov 27 11:26:15 CET 2009


2009/11/27 Stefan Lesicnik <stefan at lsd.co.za>:
> s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
> #s.setdefaulttimeout(10000)
> s.connect((proxy,port))

I have never used socket but a quick look at the docs [1] my guess is
that you should use use s.settimeout() [2].

The docs say that setdefaulttimeout [3] will only be applied to *new*
socket object. You set the default after creating the socket object.

Greets
Sander

[1] http://docs.python.org/library/socket.html
[2] http://docs.python.org/library/socket.html#socket.socket.settimeout
[3] http://docs.python.org/library/socket.html#socket.setdefaulttimeout


More information about the Tutor mailing list