java ftp 关闭连接,已收到FTP响应421。服务器关闭连接

使用Apache Commons Net FTPClient进行JAVA FTP操作时,程序在大约5分钟后抛出IOException,提示FTP响应421,服务器关闭连接。尝试设置超时时间和进入被动模式,以及发送NOOP命令,但问题依旧。错误可能与服务器连接限制或连接复用有关,建议检查并确保正确关闭或复用连接。
摘要由CSDN通过智能技术生成

I am writing a JAVA code to traverse FTP Location using Apache Commons Net FTPClient and getting output in an Excel file. the code execute correctly for approx 5 min but then gives an IOException:

org.apache.commons.net.ftp.FTPConnectionClosedException: FTP response 421 received. Server closed connection.

I am using commons-net-3.0.1.jar. I have done some R&D and tried:

setDefaultTimeout(6000);

setConnectTimeout(3000);

setSoTimeout(3000);

enterLocalPassiveMode();

and sending NOOP, but still getting the same error.

All I am trying to do is traverse through a directory and if file is found than get file name and file update date in excel else if directory is found then get inside and do until file is found again.

Please help and ask if any other information is required. I am new to JAVA.

解决方案

Error 421 Serv

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值