jakarta/commons.net



I'm having a devil of a time getting the jakarta ftp lib to work
correctly.

The problem seems to be that the server I want to download to is behind a
firewall. I'm setting the mode to PASV via the command ftp.enterLocalMode
() but it's not working. Here's a snippet and the resulting output.
Anyone know of any problems that are specific to Jakarta?

< begin snippet >
// setup the ftp connection
FTPClient ftp = new FTPClient ();
ftp.connect (src);
ftp.login ("xxxx","xxxx");

ftp.setRemoteVerificationEnabled(false);
System.out.println("..remote verify off");
System.out.println ("FTP: Connected to " + src +".");
System.out.print (ftp.getReplyString ());
ftp.enterLocalPassiveMode();
System.out.print (ftp.getReplyString ());
System.out.println (ftp.getStatus ());
System.out.println(ftp.getPassiveHost());
System.out.println(ftp.getPassivePort());

InputStreamReader isr = null;
try {
isr = new InputStreamReader (ftp.retrieveFileStream
("xxxx.csv"));
boolean success = ftp.completePendingCommand();
} catch (FTPConnectionClosedException e){
System.out.print (ftp.getReplyString ());
e.printStackTrace();
} catch (IOException e) {
System.out.print (ftp.getReplyString ());
e.printStackTrace();
} catch (Exception e) {
System.out.print (ftp.getReplyString ());
e.printStackTrace();
}

< end snippet>

< begin output >
Beginning timestamp Tue Sep 05 01:23:30 EDT 2006
...remote verify off
FTP: Connected to XXX.XXX.com.
200 Switching to ASCII mode.
200 Switching to ASCII mode.
211-FTP server status:
Connected to XXX.XXX.XXX.X
Logged in as ftpsecure
TYPE: ASCII
No session bandwidth limit
Session timeout in seconds is 300
Control connection is plain text
Data connections will be plain text
At session startup, client count was 1
vsFTPd 2.0.1 - secure, fast, stable
211 End of status

null <<< notice that it's not returning the passive host address
-1 <<< or the port!


It ultimately times out.

Any ideas?


.