Monday 15 February 2010

java - Apache Commons Net Slow FTP Upload -


I am using Apache Commons Net 3.3 to handle FTP transfers in a Java application.

The download is working very well, but I am getting very slow speed compared to local internet connection capabilities.

The code writing the file data in that stream looks like this:

  BufferedOutputStream Out = New BufferedOutputStream (ftp.getOutputStream (prt)); BufferedInputStream = new BufferedInputStream (prov.getInputStream (S)); Byte [] Buff = New Byte [BUFF_SIZE]; Int len; While ((lain = in. Read (fond)) gt; = 0 & amp;; prog.is was canceled ()) {out.write (buff, 0, len); Total + = Lane; Prog.set progress ((int) (Math Field (Total / Combo) * 100))); } In.close (); Out.close ();   

BUFF_SIZE = 16kB

I have an FTPclient buffer size that is generated by setBufferSize

Also set to 16kB is not with i server or my internet connection, because the file is used as upload fax client by earning more reasonable speed by using FileZilla.

This issue also appears with Java 6 and 7 JVM.

Does anyone have an idea why this is happening? Is there a problem in Commons Net or Java? Or is there something that I have not configured correctly?

Same problem - try SDK 1.6 solution, but try to find a better way

UPD: solution (see comment)

No comments:

Post a Comment