10060, 'Operation timed out'

Sumit Acharya sumit.acharya at gmail.com
Wed Jan 18 02:08:54 EST 2006

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):
   y = time.time()
    ftp = FTP()
        print ftp.sendcmd('pass x')
        print sys.exc_value
    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,

More information about the Python-list mailing list