I'm trying to acess a folder in a path i created in a ftps server but it returns nothing, it's connecting but does not return anything, if i change the server configuration to just ftp it works. I'm using FileZilla Server and the its configurations is above.
SSL/TLS
Flag true Enable FTP over SSL/TLS support (FTPS) and Allow explicit FTP over TLS at SSL/TLS settings
My user configuration is:
Flat "Force SSL for user login" is true at General of user configuration at FireZilla Server.
The server's log about the connection is getting a message, i dont know if it helps:
227 Entering Passive Mode
LIST
521 PROT P required
PASV
227 Entering Passive Mode
NLST
521 PROT P required
Quit
My example class to connect is above with every permissions:
public class FTPClientExample2 {
public static void main(String[] args)
{
String server = "myip";
int port = 2121;
String user = "joao";
String pass = "1234";
boolean error = false;
FTPSClient ftp = null;
try
{
ftp = new FTPSClient("SSL");
ftp.setAuthValue("SSL");
ftp.addProtocolCommandListener(new PrintCommandListener(new PrintWriter(System.out)));
int reply;
ftp.connect(server, port);
System.out.println("Connected to ftp.wpmikz.com.cn");
System.out.print(ftp.getReplyString());
// After connection attempt, you should check the reply code to verify
// success.
reply = ftp.getReplyCode();
if (!FTPReply.isPositiveCompletion(reply))
{
ftp.disconnect();
System.err.println("FTP server refused connection.");
System.exit(1);
}
ftp.login(user, pass);
// ... // transfer files
ftp.setBufferSize(1000);
ftp.enterLocalPassiveMode();
// ftp.setControlEncoding("GB2312");
ftp.changeWorkingDirectory("/");
ftp.changeWorkingDirectory("/ae"); //path where my files are
ftp.setFileType(FTP.BINARY_FILE_TYPE);
System.out.println("Remote system is " + ftp.getSystemName());
String[] tmp = ftp.listNames(); //returns null
System.out.println(tmp.length);
}
catch (IOException ex)
{
System.out.println("Oops! Something wrong happened");
ex.printStackTrace();
}
finally
{
// logs out and disconnects from server
try
{
if (ftp.isConnected())
{
ftp.logout();
ftp.disconnect();
}
}
catch (IOException ex)
{
ex.printStackTrace();
}
}
}
}
Any idea what is wrong?
Thank you all!