This is the program that I execute
try
{
FileTransferClient ftp = new FileTransferClient();
ftp.setTimeout(60000);
ftp.setRemoteHost("10.81.114.10"); // FTP server IP
ftp.setUserName("ftpdc2");
ftp.setPassword("testPassw");
ftp.setRemotePort(21);
ftp.connect();
ftp.changeDirectory("/users");
ftp.changeDirectory("ftpdc2");
System.out.println("connect mode=" + ftp.getAdvancedFTPSettings().getConnectMode());
FTPFile[] list2 = ftp.directoryList();
ftp.disconnect(true);
}
catch (Exception e)
{
e.printStackTrace();
}
This is the log result. As you see, when it excute the command PORT, the address received is 10.84.144.8 (the FTP address where I try to connect is 10.84.144.10). This is because a Lisa Server firewall.
C:\dc2error>java TestConn
DEBUG [FTPClient] 29 jul 2009 10:40:28.182 : Class: com.enterprisedt.net.ftp.FTP
Client
Location: file:/C:/dc2error/edtftpj.jar
Version: 2.0.4
Build timestamp: 13-Feb-2009 15:09:20 EST
Java version: 1.6.0
CLASSPATH: .;./ojdbc14.jar;.;./ojdbc14.jar;.;./edtftpj.jar;./ojdbc14.jar;./junit
.jar;.;./ojdbc14.jar;
OS name: Windows XP
OS arch: x86
OS version: 5.1
DEBUG [FileTransferClient] 29 jul 2009 10:40:28.197 : Configured client
DEBUG [FTPClient] 29 jul 2009 10:40:28.197 : Connecting to /10.81.114.10:21
DEBUG [SocketUtils] 29 jul 2009 10:40:28.197 : Invoking connect with timeout=60000
DEBUG [SocketUtils] 29 jul 2009 10:40:28.244 : Connected successfully
DEBUG [FTPControlSocket] 29 jul 2009 10:40:28.275 : 220 odin FTP server (Revision 3.0 Version wuftpd-2.6.1 Wed Dec 19 08:45:38 GMT 2007) ready.
DEBUG [FileTransferClient] 29 jul 2009 10:40:28.275 : Client connected
DEBUG [FileTransferClient] 29 jul 2009 10:40:28.275 : Logging in
DEBUG [FTPControlSocket] 29 jul 2009 10:40:28.275 : ---> USER ftpdc2
DEBUG [FTPControlSocket] 29 jul 2009 10:40:28.307 : 331 Password required for ftpdc2.
DEBUG [FTPControlSocket] 29 jul 2009 10:40:28.307 : ---> PASS ********
DEBUG [FTPControlSocket] 29 jul 2009 10:40:28.353 : 230 User ftpdc2 logged in.
DEBUG [FileTransferClient] 29 jul 2009 10:40:28.353 : Logged in
DEBUG [FTPControlSocket] 29 jul 2009 10:40:28.353 : ---> TYPE I
DEBUG [FTPControlSocket] 29 jul 2009 10:40:28.369 : 200 Type set to I.
DEBUG [FTPControlSocket] 29 jul 2009 10:40:28.369 : ---> CWD /users
DEBUG [FTPControlSocket] 29 jul 2009 10:40:28.400 : 250 CWD command successful.
DEBUG [FTPControlSocket] 29 jul 2009 10:40:28.400 : ---> CWD ftpdc2
DEBUG [FTPControlSocket] 29 jul 2009 10:40:28.432 : 250 CWD command successful.
connect mode=Active
DEBUG [FTPControlSocket] 29 jul 2009 10:40:28.447 : ---> SYST
DEBUG [FTPControlSocket] 29 jul 2009 10:40:28.478 : 215 UNIX Type: L8
DEBUG [FTPControlSocket] 29 jul 2009 10:40:28.478 : ---> PWD
DEBUG [FTPControlSocket] 29 jul 2009 10:40:28.510 : 257 "/users/ftpdc2" is current directory.
DEBUG [FTPControlSocket] 29 jul 2009 10:40:28.510 : ListenOnAllInterfaces=true
DEBUG [FTPControlSocket] 29 jul 2009 10:40:28.525 : ---> PORT 10,84,144,8,5,105
DEBUG [FTPControlSocket] 29 jul 2009 10:40:28.541 : 200 PORT command successful.
DEBUG [FTPControlSocket] 29 jul 2009 10:40:28.541 : ---> LIST
DEBUG [FTPControlSocket] 29 jul 2009 10:40:28.603 : 425 Can't build data connection: Connection refused.
DEBUG [FTPActiveDataSocket] 29 jul 2009 10:40:28.603 : Calling accept()
DEBUG [FTPClient] 29 jul 2009 10:41:28.605 : Validate transfer on error after exception : Accept timed out
java.net.SocketTimeoutException: Accept timed out
at java.net.PlainSocketImpl.socketAccept(Native Method)
at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:384)
at java.net.ServerSocket.implAccept(ServerSocket.java:450)
at java.net.ServerSocket.accept(ServerSocket.java:421)
at com.enterprisedt.net.ftp.internal.FTPActiveDataSocket.acceptConnection(FTPActiveDataSocket.java:129)
at com.enterprisedt.net.ftp.internal.FTPActiveDataSocket.getInputStream(FTPActiveDataSocket.java:153)
at com.enterprisedt.net.ftp.FTPClient.dir(FTPClient.java:3351)
at com.enterprisedt.net.ftp.FTPClient.dirDetails(FTPClient.java:3282)
at com.enterprisedt.net.ftp.FileTransferClient.directoryList(FileTransferClient.java:568)
at com.enterprisedt.net.ftp.FileTransferClient.directoryList(FileTransferClient.java:554)
at TestConn.test(TestConn.java:30)
at TestConn.main(TestConn.java:42)
java.net.SocketTimeoutException: Accept timed out
at java.net.PlainSocketImpl.socketAccept(Native Method)
at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:384)
at java.net.ServerSocket.implAccept(ServerSocket.java:450)
at java.net.ServerSocket.accept(ServerSocket.java:421)
at com.enterprisedt.net.ftp.internal.FTPActiveDataSocket.acceptConnection(FTPActiveDataSocket.java:129)
at com.enterprisedt.net.ftp.internal.FTPActiveDataSocket.getInputStream(FTPActiveDataSocket.java:153)
at com.enterprisedt.net.ftp.FTPClient.dir(FTPClient.java:3351)
at com.enterprisedt.net.ftp.FTPClient.dirDetails(FTPClient.java:3282)
at com.enterprisedt.net.ftp.FileTransferClient.directoryList(FileTransferClient.java:568)
at com.enterprisedt.net.ftp.FileTransferClient.directoryList(FileTransferClient.java:554)
at TestConn.test(TestConn.java:30)
at TestConn.main(TestConn.java:42)
ERROR [FTPControlSocket] 29 jul 2009 10:41:29.105 : Read failed ('' read so far)
WARN [FTPClient] 29 jul 2009 10:41:29.105 : Validate transfer on error failed : Read timed out
com.enterprisedt.net.ftp.ControlChannelIOException: Read timed out
at com.enterprisedt.net.ftp.FTPControlSocket.readLine(FTPControlSocket.java:962)
at com.enterprisedt.net.ftp.FTPControlSocket.readReply(FTPControlSocket.java:997)
at com.enterprisedt.net.ftp.FTPClient.validateTransfer(FTPClient.java:2347)
at com.enterprisedt.net.ftp.FTPClient.validateTransferOnError(FTPClient.java:2379)
at com.enterprisedt.net.ftp.FTPClient.dir(FTPClient.java:3362)
at com.enterprisedt.net.ftp.FTPClient.dirDetails(FTPClient.java:3282)
at com.enterprisedt.net.ftp.FileTransferClient.directoryList(FileTransferClient.java:568)
at com.enterprisedt.net.ftp.FileTransferClient.directoryList(FileTransferClient.java:554)
at TestConn.test(TestConn.java:30)
at TestConn.main(TestConn.java:42)
com.enterprisedt.net.ftp.ControlChannelIOException: Read timed out
at com.enterprisedt.net.ftp.FTPControlSocket.readLine(FTPControlSocket.java:962)
at com.enterprisedt.net.ftp.FTPControlSocket.readReply(FTPControlSocket.java:997)
at com.enterprisedt.net.ftp.FTPClient.validateTransfer(FTPClient.java:2347)
at com.enterprisedt.net.ftp.FTPClient.validateTransferOnError(FTPClient.java:2379)
at com.enterprisedt.net.ftp.FTPClient.dir(FTPClient.java:3362)
at com.enterprisedt.net.ftp.FTPClient.dirDetails(FTPClient.java:3282)
at com.enterprisedt.net.ftp.FileTransferClient.directoryList(FileTransferClient.java:568)
at com.enterprisedt.net.ftp.FileTransferClient.directoryList(FileTransferClient.java:554)
at TestConn.test(TestConn.