473,608 Members | 2,457 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.getdefau lttimeout()
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_outp ut()
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_STR EAM):
IOError: [Errno socket error] (2, 'No such file or directory') socket.setdefau lttimeout(0.1)
socket.getdefau lttimeout() 0.1000000000000 0001 urllib.urlopen( 'http://www.python.org' ) <addinfourl at -1209281748 whose fp = <socket._fileob ject object at
0xb7bc3f0c>>>>> socket.setdefau lttimeout(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_outp ut()
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.setdefau lttimeout(0.05)
urllib.urlopen( 'http://www.python.org' )

<addinfourl at -1209306484 whose fp = <socket._fileob ject 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 2792

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
52168
by: Achim Domma | last post by:
Hi, I'm using Python 2.3s timeout sockets and have code like this to read a page from web: request = ... self.page = urllib2.urlopen(request) and later:
3
2647
by: Thomas Hervé | last post by:
My problem is not really python specific but as I do my implementation in python I hope someone here can help me. I have two programs that talk through a socket. Here is the code : <server> sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) sock.settimeout(5.0)
1
3809
by: martinnitram | last post by:
Dear all, following are some piece of my code (mainly create a socket connection to server and loop to receive data): # function to create and return socket def connect(): server_config = ('192.168.1.50', 3333); sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) try: sock.connect()
3
4620
by: Robert A. van Ginkel | last post by:
Hello Fellow Developer, I use the System.Net.Sockets to send/receive data (no tcpclient/tcplistener), I made a receivethread in my wrapper, the receivethread loops/sleeps while waiting for data and then fires a datareceived event. Within the waitingloop there is a timeout function, but I want the the 'last-time-socket-used' variable set when the socket is finished sending. When I send by System.Net.Sockets.Socket.Send(buffer()) (<--this...
1
4442
by: jnair | last post by:
When using socket.socket.settimeout we normally only guard against "socket.timeout" exception.Now the implementation of "settimeout" in "Python-2.4.3/Modules/socketmodule.c" sets the socket fd to nonblocking and uses "select()" to timeout as seen below in line 1487 and 1386 : static PyObject * 1470 sock_settimeout(PySocketSockObject *s, PyObject *arg) 1471 { 1472 double timeout;
4
5110
by: gaddamreddy | last post by:
Hai to all frns, Reqirement 1: 1.I need to send a Request to one server through UDP socket.at that time i have to start a timer (setted to 2 sec) if i wont get the Response/ACK from that corresponding ACK from that server within 2 sec.i need to send the Request again. for this i did like this. #include <sys/types.h> #include <sys/socket.h>
2
2795
by: Robin Becker | last post by:
While messing about with some deliberate socket timeout code I got an unexpected timeout after 20 seconds when my code was doing socket.setdefaulttimeout(120). Closer inspection revealed that this error in fact seemed to come from the os (in this case windows xp). By inspection of test cases the error.reason from the deliberate socket timeout looks like 'timed out' whereas the windows caused timeout error.reason looks like
2
2397
by: Mirko Vogt | last post by:
Hey, it seems that the socket-module behaves differently on unix / windows when a timeout is set. Here an example: # test.py import socket sock=socket.socket(socket.AF_INET,socket.SOCK_STREAM) print 'trying to connect...'
2
3527
by: Heikki Toivonen | last post by:
M2Crypto has some old code that gets and sets socket timeouts in http://svn.osafoundation.org/m2crypto/trunk/M2Crypto/SSL/Connection.py, for example: def get_socket_read_timeout(self): return timeout.struct_to_timeout(self.socket.getsockopt(socket.SOL_SOCKET, socket.SO_RCVTIMEO, timeout.struct_size())) The helper timeout module is here:
0
8470
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8330
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6815
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5475
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3960
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4023
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2474
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1589
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1328
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.