且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

ConnectionRefusedError:[Errno 111]连接被拒绝

更新时间:2022-05-15 08:28:41

首先检查此ip以查看ftp服务是否可用,如果检查了正在监听的port,则引起该问题.也许(很少见,但可能)配置为在与标准端口 21 不同的端口上进行侦听.同样,连接可能会被防火墙阻止,这就是为什么连接被拒绝的原因.

First of all check this ip to see if ftp service is available, and if it is check the port that it is listening on, cause it maybe (rare but possible) is configured to listen on a different port than the standard one - 21 . Also maybe the connection is blocked by a firewall, and that is why connection gets refused.

还没有看到您的完整代码,但我认为另一个/不同的问题是:def placeFile()应该改为此def placeFile(ftp)-因为功能placeFile并不真正知道对您在上面创建的ftp客户端的引用.

Also haven't seen the whole code of yours but I think another/different problem is this: def placeFile() should be changed to this instead def placeFile(ftp) - cause the function placeFile doesn't really know that ftp references to the ftp client you created above.