Dear all
Currently, I found one issue while using Apache's org.apache.commons.net to connect to a FTPS site ... My code like belows:
boolean error = false;
FTPSClient ftp = null;
try
{
ftp = new FTPSClient("SSL",true);
ftp.setAuthValue("SSL");
ftp.addProtocolCommandListener(new PrintCommandListener(new PrintWriter(System.out)));
int reply;
ftp.connect("ftp.wpmikz.com.cn",990);
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("wpmnpbatch","xxxxxxxx");
// ... // transfer files
ftp.setBufferSize(1000);
ftp.enterLocalPassiveMode();
//ftp.setControlEncoding("GB2312");
ftp.changeWorkingDirectory("/");
ftp.changeWorkingDirectory("/SunShine Life/SU001SH/Interface/KZ IN/Response");
ftp.setFileType(FTP.BINARY_FILE_TYPE);
System.out.println("Remote system is " + ftp.getSystemName());
String[] tmp=ftp.listNames();
System.out.println(tmp.length);
Each time I run this code, it works fine in LOGIN and CD and even can retrieve the currenct working directory name successfully, but all the time when I execute the listNames() and listFiles(), it always report 426 error -- 426 Transfer failed. But if I use other FTP tool like FileZilla and the same user and password to login this FTP site, it always succeed. Does anyone kind to help me to solve this? Thanks in advance for any help or suggestion.
Edited by: 907592 on 2012-1-16 上午12:43
Edited by: 907592 on 2012-1-16 上午12:50