开发者

Can I add timeout for ftpslib connection?

Can I add timepout for ftps connection and each command on ftp server ?

r  = ftpslib.FTP_TL开发者_StackOverflow社区S()
...


In python >= 2.6, the timeout option has been added to FTPconstructor. It will be used for each blocking operation (ie connection, receive, sending...). In python >= 2.7, the FTP_TLS object has been added (with timeout).

In python < 2.7, you'll have to modify the default global timeout on socket module with socket.setdefaulttimeout(timeout) before creating the FTP or FTP_TLS object.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜