problem with Download

  • tidan

    tidan - 2005-06-20


    I'm using JFtp's API in my program... I run it on a Unix OS and I connect to a Windows server. I tested my program on a windows OS and it work well... but, on Unix I'm unable to do more than 1 download. On the first attempt, everything work fine... But to download another file, I have to wait about 4-5 minutes....

    > Logged in...
    > SYST

    > > SYST
    215 Windows_NT version 5.0

    > 215 Windows_NT version 5.0
    > TYPE I

    > > TYPE I
    200 Type set to I.

    > 200 Type set to I.
    > MODE S

    > > MODE S
    200 Mode S ok.

    > 200 Mode S ok.
    > PORT 172,25,132,65,5,2

    > > PORT 172,25,132,65,5,2
    200 PORT command successful.

    > 200 PORT command successful.
    > RETR doc.txt

    > > RETR doc.txt
    150 Opening BINARY mode data connection for doc.txt(2406 bytes).

    > 150 Opening BINARY mode data connection for doc.txt(2406 bytes).
    425 Can't open data connection.

    > 425 Can't open data connection.
    425 Can't open data connection.

    > 425 Can't open data connection.

    Someone have an idea ??

    • Cyberdemon

      Cyberdemon - 2005-06-26

      Yes, please use passive FTP (Settings.defaultFtpPasvMode = true and the regarding property should be set) - active mode is just a backup option and not intended to be used with multiple connections ;)

    • David Timerman

      David Timerman - 2005-07-22

      I am having the same problem. Unfortunately, Passive mode is not an option for me. I really could use a work around as I will need to download multiple files.

    • Cyberdemon

      Cyberdemon - 2005-07-24

      Hi, I took a look at the active ftp code and it looks like all you have to do is to change the ints porta and portb in FtpConnection to be static. Sorry for taking so long to do this, and I hope if it works for you (haven't really tested it yet, just tried it once). I can imagine some problems if one or more ports above 1280 are used by other apps, though (not tested for yet).

    • Won Jong, Yang

      Won Jong, Yang - 2006-12-12

      You should modify
      Refer the following code:

          private String getActivePortCmd() throws UnknownHostException, IOException
              InetAddress ipaddr = jcon.getLocalAddress();
              String ip = ipaddr.getHostAddress().replace('.', ',');


              int a = getPortA();
              int b = getPortB();
              String ret = "PORT " + ip + "," + a + "," + b;
                 ServerSocket aSock = new ServerSocket(0);
              int availPort = aSock.getLocalPort();
              porta = availPort/256;
              portb = availPort%256;
              String ret = "PORT " + ip + "," + porta + "," + portb;

              return ret;

    • Cyberdemon

      Cyberdemon - 2007-03-15

      Thanks, I added the patch (but haven't tested it yet. Expect it to be in 1.50-pre2.

    • kavi tha

      kavi tha - 2008-02-01


      I am using j-ftp-1.50 for file upload.
      I am using from docs folder & jftp.jar from build/jars/
      I am getting java.lang.IncompatibleClassChangeError while deploying in jboss4.2.2GA.
      I am not getting any error while deploying in tomcat & jboss 4.0.5.
      Please help me out.


Log in to post a comment.