Hi, I have a problem with the "exists" method, if it the first call after a connection is made in passive mode.
I'm using the latest version (2.3.0 ) of edtftpj free library.
2 exemples :
try {
FileTransferClient ftp = new FileTransferClient();
ftp.setRemoteHost("myServer");
ftp.setUserName("myUSername");
ftp.setPassword("myPassword");
ftp.setRemotePort(21);
ftp.connect();
ftp.getAdvancedFTPSettings().setConnectMode(FTPConnectMode.PASV);
ftp.exists("anyFile");
} catch(Exception e)
{
e.printStackTrace();
}
KO : com.enterprisedt.net.ftp.FTPException: 500 I won't open a connection to xx.xx.xx.xx (only to yy.yy.yy.yy)
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: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.FTPClient.dirDetails(FTPClient.java:3583)
at com.enterprisedt.net.ftp.FTPClient.existsFile(FTPClient.java:2065)
at com.enterprisedt.net.ftp.FTPClient.exists(FTPClient.java:2110)
at com.enterprisedt.net.ftp.FileTransferClient.exists(FileTransferClient.java:944)
at com.kewego.commons.util.FtpCopier.main(FtpCopier.java:794)
But if I do :
try {
FileTransferClient ftp = new FileTransferClient();
ftp.setRemoteHost("myServer");
ftp.setUserName("myUSername");
ftp.setPassword("myPassword");
ftp.setRemotePort(21);
ftp.connect();
ftp.getAdvancedFTPSettings().setConnectMode(FTPConnectMode.PASV);
ftp.directoryList();
ftp.exists("anyFile");
} catch(Exception e)
{
e.printStackTrace();
}
OK : There's no problem.
Do you know why it is happening ?
Thank you for your help !
Nelson