j_alen 2015-06-02 01:22 采纳率: 0%
浏览 7230

linux环境下下 FTPClient.retrieveFile() 下载稍大一点的文件就卡死了

FTPClient f = new FTPClient();   
    OutputStream out = null;
        f.connect(url,port);
          f.login(username, password);
          f.enterLocalPassiveMode();   //被动

         f.setControlEncoding("GBK");  
         f.setFileType(FTPClient.BINARY_FILE_TYPE);  
          f.setFileTransferMode(FTPClient.STREAM_TRANSFER_MODE);
        //f.setBufferSize(524288);
        //f.setSoTimeout(300000);     //  时间
        //f.setDataTimeout(300000);   //  时间
        f.changeWorkingDirectory(f.printWorkingDirectory()+ remotePath);   

        FTPListParseEngine engine = f.initiateListParsing(remotePath);
         FTPFile[] files = null;
        while (engine.hasNext()) {
            files = engine.getNext(25);  // "page size" you want
            for(FTPFile ff:files){   
                 if(ff.getName().equals(fileName)){   
                     File outfile = new File(localPath+"/"+newfilename);    
                     out = new BufferedOutputStream(new FileOutputStream(outfile));

                   logger.info(remotePath+"/"+ff.getName());
                    logger.info(remotePath+"/"+new String(ff.getName().getBytes("GBK"),"ISO-8859-1"));
                    boolean is = f.retrieveFile(remotePath+"/"+new String(ff.getName().getBytes("GBK"),"ISO-8859-1"), out);  

                     out.flush();
                     out.close(); 

                 }   
            }   

            i++;
        }
        f.logout();   


        下载一个 1kb的文件可以正常下载,说明权限是没问题的,9kb的文件就下载不了了,环境是linux+tomcat,   求教        
            另: windows环境下是正常的
  • 写回答

3条回答 默认 最新

  • 一枪尽骚丶魂 2015-06-02 01:31
    关注

    下载大小应该可以设置吧

    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog