Can anyone explain me what\'s wrong with the following code? I tried different hosts, FTPClientConfigs, it\'s properly accessible via firefox/filezilla... The problem is I a
Only using enterLocalPassiveMode() did not work for me.
I used following code, which worked.
ftpsClient.execPBSZ(0);
ftpsClient.execPROT("P");
ftpsClient.type(FTP.BINARY_FILE_TYPE);
Complete example is as below,
FTPSClient ftpsClient = new FTPSClient();
ftpsClient.connect("Host", 21);
ftpsClient.login("user", "pass");
ftpsClient.enterLocalPassiveMode();
ftpsClient.execPBSZ(0);
ftpsClient.execPROT("P");
ftpsClient.type(FTP.BINARY_FILE_TYPE);
FTPFile[] files = ftpsClient.listFiles();
for (FTPFile file : files) {
System.out.println(file.getName());
}