469,609 Members | 1,657 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,609 developers. It's quick & easy.

socket timeout error?

Hi,

Running Fedora Core 4: Python 2.4.3 and Python 2.4.1.
I'm getting:
IOError: [Errno socket error] (2, 'No such file or directory')
all the time.

Trying to track down this problem:

Python 2.4.1 (#1, May 16 2005, 15:19:29)
[GCC 4.0.0 20050512 (Red Hat 4.0.0-5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
import socket
socket.getdefaulttimeout()
import urllib
urllib.urlopen('http://www.python.org') Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "urllib.py", line 77, in urlopen
return opener.open(url)
File "urllib.py", line 180, in open
return getattr(self, name)(url)
File "urllib.py", line 296, in open_http
h.endheaders()
File "/usr/lib/python2.4/httplib.py", line 794, in endheaders
self._send_output()
File "/usr/lib/python2.4/httplib.py", line 675, in _send_output
self.send(msg)
File "/usr/lib/python2.4/httplib.py", line 642, in send
self.connect()
File "/usr/lib/python2.4/httplib.py", line 610, in connect
socket.SOCK_STREAM):
IOError: [Errno socket error] (2, 'No such file or directory') socket.setdefaulttimeout(0.1)
socket.getdefaulttimeout() 0.10000000000000001 urllib.urlopen('http://www.python.org') <addinfourl at -1209281748 whose fp = <socket._fileobject object at
0xb7bc3f0c>>>>> socket.setdefaulttimeout(0.01) urllib.urlopen('http://www.python.org') Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "urllib.py", line 77, in urlopen
return opener.open(url)
File "urllib.py", line 180, in open
return getattr(self, name)(url)
File "urllib.py", line 296, in open_http
h.endheaders()
File "/usr/lib/python2.4/httplib.py", line 794, in endheaders
self._send_output()
File "/usr/lib/python2.4/httplib.py", line 675, in _send_output
self.send(msg)
File "/usr/lib/python2.4/httplib.py", line 642, in send
self.connect()
File "/usr/lib/python2.4/httplib.py", line 626, in connect
raise socket.error, msg
IOError: [Errno socket error] timed out socket.setdefaulttimeout(0.05)
urllib.urlopen('http://www.python.org')

<addinfourl at -1209306484 whose fp = <socket._fileobject object at
0xb7eb9cdc>>>>>

Seems a timeout of 0.01 is to small and a timeout >= 0.05 is working.

What is the real problem here?

Jaap
Apr 17 '06 #1
0 2615

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

17 posts views Thread by Achim Domma | last post: by
3 posts views Thread by Thomas Hervé | last post: by
1 post views Thread by martinnitram | last post: by
3 posts views Thread by Robert A. van Ginkel | last post: by
1 post views Thread by jnair | last post: by
2 posts views Thread by Robin Becker | last post: by
reply views Thread by Solution2021 | last post: by
reply views Thread by devrayhaan | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.