commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Denis Molony (JIRA)" <>
Subject [jira] [Created] (NET-499) FTP transfer to mainframe extremely slow
Date Sat, 02 Feb 2013 05:56:12 GMT
Denis Molony created NET-499:

             Summary: FTP transfer to mainframe extremely slow
                 Key: NET-499
             Project: Commons Net
          Issue Type: Bug
          Components: FTP
    Affects Versions: 3.2
         Environment: Windows and OSX
            Reporter: Denis Molony

FTPClient.storeFile() is incredibly slow. I have two example files, one FB (4MB) and one in
ravel VB (94K) format. Under 3.1 both files transfer in less than a second (FB:328ms, VB:112ms).
Under 3.2 the VB transfer takes 30,000ms, and the FB transfer takes too long to find out (>
15 minutes).

I have checked the FB file on the mainframe after cancelling the transfer and it is always
partly there. But the length varies, suggesting that it hasn't hit the same error each time.

I have built two jar files, one with 3.1 and the other with 3.2. These jars are available.
The code is as follows:

public class FTPTransfer
  public static void transfer (String name, FTPClient ftp, File file) throws IOException
    FileInputStream fis = new FileInputStream (file);
    long start = System.currentTimeMillis ();

    if (ftp.storeFile (name, fis))
      System.out.print ("File transferred");
      System.out.print ("Transfer failed");

    System.out.printf (" in %d ms%n", (System.currentTimeMillis () - start));
    fis.close ();

  public static void main (String[] args)
    File file1 = null;
    File file2 = null;

    if (System.getProperty ("").toLowerCase ().startsWith ("mac"))
      file1 = new File ("/Users/Denis/comtest/DENIS-018.SRC");   // ravel file format
      file2 = new File ("/Users/Denis/comtest/MOLONYD.NCD");     // FB252 format
      file1 = new File ("D:/comtest/DENIS-018.SRC");   // ravel file format
      file2 = new File ("D:/comtest/MOLONYD.NCD");     // FB252 format

    FTPClient ftp = new FTPClient ();
    ftp.addProtocolCommandListener (new PrintCommandListener (new PrintWriter (System.out),

      ftp.connect ("server");

      int reply = ftp.getReplyCode ();

      if (!FTPReply.isPositiveCompletion (reply))
        ftp.disconnect ();
        System.err.println ("FTP server refused connection.");
        System.exit (1);

      ftp.login ("user", "pw");
      FTPFile[] files = ftp.listFiles ();
      System.out.printf ("%nListing contains %d files%n%n", files.length);

      ftp.setFileType (FTP.BINARY_FILE_TYPE);

      ftp.setFileStructure (FTP.RECORD_STRUCTURE);
      transfer ("TEST.VB", ftp, file1);

      ftp.setFileStructure (FTP.FILE_STRUCTURE);
      transfer ("TEST.FB", ftp, file2);

      ftp.logout ();
    catch (IOException e)
      e.printStackTrace ();
      if (ftp.isConnected ())
          ftp.disconnect ();
        catch (IOException ioe)


This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:

View raw message