Java 使用FTPS TLS连接到FTP
尝试使用FTP连接到FTP服务器(“TLS”,隐式)时出错Java 使用FTPS TLS连接到FTP,java,ftps,Java,Ftps,尝试使用FTP连接到FTP服务器(“TLS”,隐式)时出错 FTPSClient ftps = new FTPSClient("TLS"); ftps.addProtocolCommandListener(new PrintCommandListener(new PrintWriter(System.out))); int reply; try { ftps.connect("server"); } catch (IOException ex) {
FTPSClient ftps = new FTPSClient("TLS");
ftps.addProtocolCommandListener(new PrintCommandListener(new PrintWriter(System.out)));
int reply;
try {
ftps.connect("server");
} catch (IOException ex) {
Logger.getLogger(Ftpimport.class.getName()).log(Level.SEVERE, null, ex);
}
reply = ftps.getReplyCode();
if (!FTPReply.isPositiveCompletion(reply)) {
try {
ftps.disconnect();
} catch (IOException ex) {
Logger.getLogger(Ftpimport.class.getName()).log(Level.SEVERE, null, ex);
}
throw new Exception("Exception in connecting to FTPs Server");
}
ftps.execPBSZ(0);
ftps.execPROT("P");
ftps.login("user", "pass");
ftps.setFileType(FTP.BINARY_FILE_TYPE);
ftps.enterLocalPassiveMode();
它在“234 AUTH command ok.期待TLS协商”中出现问题。使用SSLContext和TrustManager进行了尝试,结果都是一样的。只是为了确保。。。您是否尝试过ftps.connect()?(即:使用InetAddress)是的,他在那里输出220 Microsoft FTP服务{message}220--Auth TLS 234 Auth命令ok。期待TLS谈判(在这里被绊倒)。