我有一个程序,每当用户发出命令时,该程序便与FTP服务器交互。这是我的代码的基本结构:
from ftplib import FTP
ftp = FTP(host=host)
login_status = ftp.login(user=username,passwd=password)
while True:
command = input()
if command == "abc":
ftp.storbinary(textfile,textmessage1)
elif command == "def":
ftp.storbinary(textfile,textmessage2)
问题是,如果我在两次发出命令之间等待大约20秒(即,如果我离开程序大约20秒),并尝试在20秒间隔后发出命令,则会弹出此错误消息:{{1 }}
据我了解,ftp服务器有时间限制,不活动后会踢您。我正在寻找一种使FTP服务器保持繁忙并停止让它启动程序的方法。基本上,任何阻止该错误消息再次出现的解决方案。
谢谢!