Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
8.8k views
in Java FTP by (200 points)
I am using edtftpj 2.2.2 APis and is running into following exception. I am able to connect to the host and list directory using "ftp" program. I have replaced the ipAddress of my host with <myHost>

DEBUG [FTPControlSocket] 9 Sep 2011 18:13:19.370 : 220 ProFTPD 1.3.1 Server (ProFTPD) [<myHost>]
DEBUG [FileTransferClient] 9 Sep 2011 18:13:19.371 : Client connected
DEBUG [FileTransferClient] 9 Sep 2011 18:13:19.371 : Logging in
DEBUG [FTPControlSocket] 9 Sep 2011 18:13:19.371 : ---> USER test
DEBUG [FTPControlSocket] 9 Sep 2011 18:13:19.387 : 331 Password required for test
DEBUG [FTPControlSocket] 9 Sep 2011 18:13:19.388 : ---> PASS ********
DEBUG [FTPControlSocket] 9 Sep 2011 18:13:19.427 : 230 User test logged in
DEBUG [FileTransferClient] 9 Sep 2011 18:13:19.427 : Logged in
DEBUG [FTPControlSocket] 9 Sep 2011 18:13:19.427 : ---> TYPE I
DEBUG [FTPControlSocket] 9 Sep 2011 18:13:19.447 : 200 Type set to I
18:13:19,448 INFO [ConnectorTest] Connection successful to host <myHost>
DEBUG [FTPControlSocket] 9 Sep 2011 18:13:19.463 : ---> SYST
DEBUG [FTPControlSocket] 9 Sep 2011 18:13:19.478 : 215 UNIX Type: L8
DEBUG [FTPControlSocket] 9 Sep 2011 18:13:19.487 : ---> PWD
DEBUG [FTPControlSocket] 9 Sep 2011 18:13:19.502 : 257 "/" is the current directory
DEBUG [FTPControlSocket] 9 Sep 2011 18:13:19.503 : ListenOnAllInterfaces=true
DEBUG [FTPControlSocket] 9 Sep 2011 18:13:19.504 : ---> PORT 10,172,154,82,234,128
DEBUG [FTPControlSocket] 9 Sep 2011 18:13:19.519 : 500 Illegal PORT command
INFO [FTPControlSocket] 9 Sep 2011 18:13:19.519 : Expected reply codes = [200,250]
18:13:19,521 ERROR [FtpConnector] Failed to list current directory
com.enterprisedt.net.ftp.FTPException: 500 Illegal PORT command
at com.enterprisedt.net.ftp.FTPControlSocket.validateReply(FTPControlSocket.java:1223)
at com.enterprisedt.net.ftp.FTPControlSocket.setDataPort(FTPControlSocket.java:815)
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:2596)
at com.enterprisedt.net.ftp.FTPClient.dir(FTPClient.java:3586)
at com.enterprisedt.net.ftp.FTPClient.dir(FTPClient.java:3678)
at com.enterprisedt.net.ftp.FTPClient.dirDetails(FTPClient.java:3507)
at com.enterprisedt.net.ftp.FileTransferClient.directoryList(FileTransferClient.java:644)
at com.enterprisedt.net.ftp.FileTransferClient.directoryList(FileTransferClient.java:630)

6 Answers

0 votes
by (162k points)
use ftp.getAdvancedFTPSettings().setActiveIPAddress("<host ip>")
0 votes
by (200 points)
from the logs ------ PORT 10,172,154,82,234,128

10.172.154.82 is the correct IP address from where my java program is connecting to <myHost>. Do you still think I should use ftp.getAdvancedFTPSettings().setActiveIPAddress("10.172.154.82") ?
0 votes
by (162k points)
Ok, that won't help then. I thought it might have been a local address.

Try using Windows ftp.exe to see if that works. Otherwise you might have to switch to passive mode - I can't see anything wrong with the PORT command you sent.
0 votes
by (200 points)
from my windows development box. Everything works fine. ftp.exe and the java program are successful.

But from a linux box(Amazon Linux AMI release 2011.02.1.1) the java program does not work but if I use the ftp program it works fine.
0 votes
by (162k points)
Post the debug output from the ftp program on Linux. There must be something different about the PORT command used.
0 votes
by (200 points)
this happens when you are using NAT. you should do some configuration on router.

Categories

...