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

Chen chenpuqing at 163.net
Tue Feb 25 20:12:18 EST 2003


Yeah. My current program, written in python-2.2.2 and with the help of
timeoutsocket.py, works in the way you mentioned.

The 2.3 version of python provides 'settimeout' and 'gettimeout' methods for
any 'socket' object, so it's possible to re-implement the function without
timeoutsocket.py. But ftplib creates the 'FTP.sock' attribute in
'FTP.connect' method. So I can't use the timeout function before the
connection is established. I think it's a problem of ftplib.py but not
socket.py.


> Well, truthfully it was probably never a very good idea to go poking
around
> in the implementation details of the FTP object. The recommended way to
get
> the right timeout using O'Malley's module was to use its
> "setdefaulttimeout()" function to establish a default timeout far any
> sockets created without knowledge of the library.
>
> Isn't there an equivalent to this in the new socket module?
>
> regards
> --
> Steve Holden                                  http://www.holdenweb.com/
> Python Web Programming                 http://pydish.holdenweb.com/pwp/
> Register for PyCon now!            http://www.python.org/pycon/reg.html
>
>
>






More information about the Python-list mailing list