[ https://issues.apache.org/jira/browse/NET-499?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13569485#comment-13569485 ]
Sebb commented on NET-499: -------------------------- This sounds like the same issue as NET-465 and NET-493 which has been fixed in the current code. If you are prepared to try a snapshot that would establish it. There's also a code work-round: set the socket size to zero before opening the connection (see NET-493). > FTP transfer to mainframe extremely slow > ---------------------------------------- > > Key: NET-499 > URL: https://issues.apache.org/jira/browse/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: > <code> > 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"); > else > 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 ("os.name").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 > } > else > { > 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), true)); > try > { > 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 (); > } > finally > { > if (ftp.isConnected ()) > { > try > { > ftp.disconnect (); > } > catch (IOException ioe) > { > } > } > } > } > } > </code> -- 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: http://www.atlassian.com/software/jira