Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
2.4k views
in Java FTP by (120 points)
Hello, I have a problem with FTP Client. I can connect to ftp server with filezilla.

my code is:

com.enterprisedt.util.debug.Logger.setLevel(com.enterprisedt.util.debug.Level.DEBUG);
FileTransferClient ftp = new FileTransferClient();
ftp.setRemoteHost(host);
ftp.setUserName(username);
ftp.setPassword(password);
ftp.setRemotePort(21);
ftp.connect();
String[] descriptions = ftp.directoryNameList();

And I am getting as result this:

DEBUG [FileTransferClient] 3 Ιουλ 2012 10:41:09.243 : Configured client
DEBUG [FTPClient] 3 Ιουλ 2012 10:41:09.244 : Connecting to /10.10.10.124:21
DEBUG [FTPControlSocket] 3 Ιουλ 2012 10:41:09.254 : 220-FileZilla Server version 0.9.33 beta
DEBUG [FTPControlSocket] 3 Ιουλ 2012 10:41:09.254 : 220 Welcome to Vermantia FTP!
DEBUG [FileTransferClient] 3 Ιουλ 2012 10:41:09.255 : Client connected
DEBUG [FileTransferClient] 3 Ιουλ 2012 10:41:09.255 : Logging in
DEBUG [FTPControlSocket] 3 Ιουλ 2012 10:41:09.255 : ---> USER ********
DEBUG [FTPControlSocket] 3 Ιουλ 2012 10:41:09.256 : 331 Password required for gbiracing
DEBUG [FTPControlSocket] 3 Ιουλ 2012 10:41:09.256 : ---> PASS ********
DEBUG [FTPControlSocket] 3 Ιουλ 2012 10:41:09.258 : 230 Logged on
DEBUG [FileTransferClient] 3 Ιουλ 2012 10:41:09.258 : Logged in
DEBUG [FTPControlSocket] 3 Ιουλ 2012 10:41:09.258 : ---> TYPE I
DEBUG [FTPControlSocket] 3 Ιουλ 2012 10:41:09.259 : 200 Type set to I
DEBUG [FTPControlSocket] 3 Ιουλ 2012 10:41:09.259 : ---> CWD test
DEBUG [FTPControlSocket] 3 Ιουλ 2012 10:41:09.261 : 250 CWD successful. "/test" is current directory.
DEBUG [FTPControlSocket] 3 Ιουλ 2012 10:41:09.261 : ---> PWD
DEBUG [FTPControlSocket] 3 Ιουλ 2012 10:41:09.262 : 257 "/test" is current directory.
true dir: /test
DEBUG [FTPControlSocket] 3 Ιουλ 2012 10:41:09.262 : ---> PWD
DEBUG [FTPControlSocket] 3 Ιουλ 2012 10:41:09.264 : 257 "/test" is current directory.
DEBUG [FTPControlSocket] 3 Ιουλ 2012 10:41:09.266 : ListenOnAllInterfaces=true
DEBUG [FTPControlSocket] 3 Ιουλ 2012 10:41:09.268 : ---> PORT 10,10,10,150,86,135
ERROR [FTPControlSocket] 3 Ιουλ 2012 10:41:09.268 : Read failed ('' read so far)
Exception in thread "main" com.enterprisedt.net.ftp.ControlChannelIOException: Connection reset
at com.enterprisedt.net.ftp.FTPControlSocket.readLine(FTPControlSocket.java:1041)
at com.enterprisedt.net.ftp.FTPControlSocket.readReply(FTPControlSocket.java:1076)
at com.enterprisedt.net.ftp.FTPControlSocket.sendCommand(FTPControlSocket.java:1000)
at com.enterprisedt.net.ftp.FTPControlSocket.setDataPort(FTPControlSocket.java:813)
at com.enterprisedt.net.ftp.FTPControlSocket.sendPORTCommand(FTPControlSocket.java:669)
at com.enterprisedt.net.ftp.FTPControlSocket.createDataSocketActive(FTPControlSocket.java:616)
at com.enterprisedt.net.ftp.FTPControlSocket.createDataSocket(FTPControlSocket.java:583)
at com.enterprisedt.net.ftp.FTPClient.setupDataSocket(FTPClient.java:2648)
at com.enterprisedt.net.ftp.FTPClient.dir(FTPClient.java:3664)
at com.enterprisedt.net.ftp.FTPClient.dir(FTPClient.java:3756)
at com.enterprisedt.net.ftp.FileTransferClient.directoryNameList(FileTransferClient.java:622)
at test.Test.main(Test.java:42)
Java Result: 1


Thank you very much!!

1 Answer

0 votes
by (162k points)
A firewall is probably preventing the listing. Try passive mode - that may work.

Categories

...