Java Apache Commons Net 3.3下载速度慢
使用FTPClient检索文件所需的时间至少是使用lftp简单地获取文件所需时间的4倍 我做错了什么?这是我的设置Java Apache Commons Net 3.3下载速度慢,java,performance,apache-commons-net,Java,Performance,Apache Commons Net,使用FTPClient检索文件所需的时间至少是使用lftp简单地获取文件所需时间的4倍 我做错了什么?这是我的设置 client.connect(Address); client.login(Login, Pass); //client.setConnectTimeout(keepAliveTime); //client.setControlKeepAliveTimeout(keepAliveTime); //client.setControlKeepAliveReplyTimeout(kee
client.connect(Address);
client.login(Login, Pass);
//client.setConnectTimeout(keepAliveTime);
//client.setControlKeepAliveTimeout(keepAliveTime);
//client.setControlKeepAliveReplyTimeout(keepAliveTime);
//client.setBufferSize(1024*1024*10);
//client.enterLocalPassiveMode(); //any profit?
client.changeWorkingDirectory(ftpDirectory);
client.setFileType(FTP.BINARY_FILE_TYPE);
client.retrieveFile(filename,new FileOutputStream(filepath));
编辑:
我尝试了FTPClient#retrieveFileStream(字符串文件名)方法,文件下载速度与通过“lftp”一样快,但程序随后挂起completePendingCommand(),这是必需的
编辑2:Ftp4j库的速度是commons net的两倍,但仍然比我的连接速度慢一半
真的没有好的java ftp库吗?任何解决方案。我也有同样的问题。@ypriverol不,对不起。当时我选择了使用python。python更快吗。我将ftpclient对象设置为final,强制只使用一个对象。但是速度慢了两倍。在这种特殊情况下,python ftp库对我来说更快。