You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by JJ Fu <ji...@yahoo.com> on 2006/09/16 00:09:01 UTC

help with commons.net ftp

I tried to use the commons.net ftp package and here is
the code:

      FTPClient ftp = new FTPClient();
      ftp.connect( server );
      ftp.login( username, password );
      application.log("Connected to " + server + ".");
      application.log(ftp.getReplyString());

      ftp.enterLocalPassiveMode();
      ftp.setFileType(FTPClient.BINARY_FILE_TYPE);

      // List the files in the directory
      ftp.changeWorkingDirectory(folder);
      application.log("changed dir to " + folder);
     
      String [] names = ftp.listNames();   ------down
to this line 
everything is fine .

      FTPFile [] files = ftp.listFiles();    
-----this line cause exception
       ............

   The last line throws this message: exception
occured 
java.net.ConnectException: Connection refused:
connect.
Connection is already established. why it say refused?
any idea ?


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org