开发者

Can I add timeout for ftpslib connection?

开发者 https://www.devze.com 2023-03-22 09:18 出处:网络
Can I add timepout for ftps connection and each command on ftp server ? r= ftpslib.FTP_TL开发者_StackOverflow社区S()

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

精彩评论

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