Problem in dealing with timeout and ftplib? (py2.3a2)

Chen chenpuqing at
Tue Feb 25 17:49:20 CET 2003

Hi, everyone!

I'm writting an ftp resource scanner. The program starts many threads and
each one searchs in an IP range. If a host cannot be connected in a
specified time, say, 10 seconds, then the thread should go to the next host.

I've implemented the  function with python-2.2.2 and Timothy O'Malley's (many thanks to him :-) . The program works very well. But
now, since python-2.3 provides such a builtin function in, I want
to change to it.

But, I find the `sock' attribute of ftplib.FTP object is `None' before the
connection is established. So I can't use the `.sock.settimeout' method
before I use `.connect' method of FTP object.

By a little tracing, I found the `sock' attribute is created in the
`connect' method of the FTP object. So I can't use the timeout function in

I think I must change the file But, are there any other

More information about the Python-list mailing list