473,566 Members | 2,958 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

10060, 'Operation timed out'

I am using following script to connect to the server and i try the
connection for 1000 times. Some times it succeeds for all the 1000
times,but some times it fails with error:-
10060, 'Operation timed out'. When it fails with the abover error, it
seems timed out time is 20 seconds. Is there a way I can increase the
timedout time for FTP?

from ftplib import FTP
import time
import sys

host = sys.argv[1]
port = sys.argv[2]

for x in range(1000):
try:
y = time.time()
ftp = FTP()
ftp.connect(hos t,port)
ftp.login('a',' a')
try:
print ftp.sendcmd('pa ss x')
except:
print sys.exc_value
ftp.close()
except:
print sys.exc_value
r = time.time()
print "Timeout %d %d %((r-y),x)

when there is error in connecting, it comes to the outer except and
prints the value of r-y as 21. How i can increase this timeout time? or
this error indicates something else?

Please let me know asap,

Jan 18 '06 #1
11 4358
Sumit Acharya wrote:
I am using following script to connect to the server and i try the
connection for 1000 times. Some times it succeeds for all the 1000
times,but some times it fails with error:-
10060, 'Operation timed out'. When it fails with the abover error, it
seems timed out time is 20 seconds. Is there a way I can increase the
timedout time for FTP?

from ftplib import FTP
import time
import sys

host = sys.argv[1]
port = sys.argv[2]

for x in range(1000):
try:
y = time.time()
ftp = FTP()
ftp.connect(hos t,port)
ftp.login('a',' a')
try:
print ftp.sendcmd('pa ss x')
except:
print sys.exc_value
ftp.close()
except:
print sys.exc_value
r = time.time()
print "Timeout %d %d %((r-y),x)

when there is error in connecting, it comes to the outer except and
prints the value of r-y as 21. How i can increase this timeout time? or
this error indicates something else?

Please let me know asap,

In a single-threaded program you can import the socket module and then
use the socket.setdefau lttimeout() function to establish a longer timeout.

regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC www.holdenweb.com
PyCon TX 2006 www.python.org/pycon/

Jan 18 '06 #2
can u please modify the script that i have posted with your suggestion,
it will help me to a certain extent.

Thanks

Jan 18 '06 #3
Sumit Acharya wrote:
can u please modify the script that i have posted with your suggestion,
it will help me to a certain extent.

Thanks

from ftplib import FTP
import time
import sys
import socket

socket.setdefau lttimeout(60)
host = sys.argv[1]
port = sys.argv[2]

for x in range(1000):
try:
y = time.time()
ftp = FTP()
ftp.connect(hos t,port)
ftp.login('a',' a')
try:
print ftp.sendcmd('pa ss x')
except:
print sys.exc_value
ftp.close()
except:
print sys.exc_value
r = time.time()
print "Timeout %d %d %((r-y),x)

--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC www.holdenweb.com
PyCon TX 2006 www.python.org/pycon/

Jan 18 '06 #4
Hi Steve,

It didnt help, i am getting same error.

Jan 18 '06 #5
Sumit Acharya wrote:
Hi Steve,

It didnt help, i am getting same error.

After 20 seconds or 60?

regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC www.holdenweb.com
PyCon TX 2006 www.python.org/pycon/

Jan 18 '06 #6
After 20 seconds only.

Jan 18 '06 #7
Sumit Acharya wrote:
After 20 seconds only.

Of course I now realise there's no default timeout on sockets anyway, so
that likely wasn't the problem.

Which statement is failing?

You would actually get much more information without the try/except
clauses, as they are stopping the traceback from being printed - if the
error is occurring deep in the ftplib you will actually see "what and
where" with a full traceback. Your loop should read:

for x in range(1000):
ftp = FTP()
ftp.connect(hos t,port)
ftp.login('a',' a')
print ftp.sendcmd('pa ss x')
ftp.close()

Try running the script without both try/excepts and then post the full
traceback, please. You can forget about the timings for now. It may well
be an FTP server loading issue, but a traceback will give more information.

regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC www.holdenweb.com
PyCon TX 2006 www.python.org/pycon/

Jan 18 '06 #8
Hi Steve,

Thanks, I have started the run without try and except block, I will
update with the findings tomm.
Please keep this thread on for you so that I can get the solution

Jan 18 '06 #9
Hi Steve,
this is the trace I have got:-
Traceback (most recent call last):
File "sumit1.py" , line 39, in ?
ftp.connect(hos t,port)
File "C:\programs\pa ckages\python24 \lib\ftplib.py" , line 129, in
connect
raise socket.error, msg
socket.error: (10060, 'Operation timed out')

Jan 19 '06 #10

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

Similar topics

3
8185
by: willitfw | last post by:
Does anyone know how to prevent this error from occurring: IOError: (10060, 'Operation timed out'). I am using the following code without any luck. Obviously I am missing something. import socket socket.setdefaulttimeout(20) Thank you in advance.
0
1722
by: Ajay Abhyankar | last post by:
Hi, I am trying to upload zip files using ftplib module. The server has Vsftpd 2.0.3 installed on it. I was able to succesfully upload files using ftplib and Vsftpd on the server locally connected. Now, I want to transfer files to remote server using the same script. I am getting the following error: Traceback (most recent call last):...
1
8174
by: Joško Šugar | last post by:
I have a data transfer between an c# application and web service. The application is in local network and connects to the internet thru a gateway. Connection is ADSL. Web service is on the remote server. Timeuots are configured as follows: local timeout: <add key="WebService.Timeout" value="300000" /> remote timeout: <httpRuntime...
5
9015
by: Sachin Surana | last post by:
We use HttpWebRequest to send the request at a URL. But some times the method GetResponse throws a time out exception. But when we check the IIS logs, there is no such entry. So the request never reached the server but the client is getting a time out exception. What could be the possible reasons? Confirmed that the request does not get...
4
2923
by: Joe | last post by:
I'm hosting my web service on a Windows 2003 box which is remotely located. When trying to add a web reference to a C# project I get an error message 'There was an error downloading 'http://mydomain.com:port/webservice.asmx' The operation has timed-out (I've tried with and without using a separate port for the service) The weird thing is...
2
25445
by: tlan | last post by:
Hi, I got this error when I move my web service to Windows2003 server. I spent hours scouting on the internet and could find any answer. Please help!!! I the webservice is timeout between 1 -2 minutes when my web app, which consume this webService, retrieves a large amount of data. When I perform the same operation to retrieve smaller...
3
16546
by: JuHui | last post by:
I wrote a script to get 100 pages from a server. like below: 1:import httplib 2:conns = httplib.HTTPConnection("www.mytest.com") 3:conn.request("GET", "/") sometimes a socket error was raised. File "D:\usr\bin\lib\httplib.py", line 627, in connect
10
19130
by: Jim Underwood | last post by:
I am having a problem with my web page timng out while retrieving a long runnign report (90-120 seconds. I have tried modifying several settings in various places and cannot get it to run for more than 90 seconds. I am running VS.Net and the app is ASP.Net, written using VB.Net. The app calls an asp.Net web service to retrieve the report. ...
0
2614
by: Jinshi | last post by:
Hello, everyone, I am quite new to python and I don't know how to solve this problem. I hope someone can help me. I just did a test in python shell: Traceback (most recent call last): File "c:\Zope\<string>", line 1, in ? File "C:\Zope\2.10.5\Python\Lib\urllib2.py", line 130, in urlopen
0
7584
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7893
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8109
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...
0
7953
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...
0
6263
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...
1
5485
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5213
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...
0
3626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1202
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.