Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/performance/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/sorting/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Apache Commons Net 3.3下载速度慢_Java_Performance_Apache Commons Net - Fatal编程技术网

Java Apache Commons Net 3.3下载速度慢

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

使用FTPClient检索文件所需的时间至少是使用lftp简单地获取文件所需时间的4倍

我做错了什么?这是我的设置

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库对我来说更快。