问题描述
以下代码以被动模式连接到远程机器
.container {
white-space: pre-line;
}
我收到代码 226 成功传输,文件时间戳也得到更新,但文件仍然为 0kb 空。
写操作失败,出现异常javax.net.ssl.SSLHandshakeException: No new session is allowed and no existing session can be resumed
从库代码中,它在 apache-commons-net 的 FTPSClient 的 public void connect(ConnectionManager connectionManager) throws IOException {
Objects.requireNonNull(connectionManager,"Can't process with null ConnectionManager object.");
if (connectionManager.getPort() == 990) {
ftpsClient = new FTPSClient(true);
//ftpsClient.setAuthValue("TLSv1.2");
//ftpsClient.setTrustManager(TrustManagerUtils.getAcceptAllTrustManager());
} else {
ftpsClient = new FTPSClient();
}
ftpsClient.setConnectTimeout(connectionManager.getConnectionTimeout());
ftpsClient.connect(connectionManager.getHost(),connectionManager.getPort());
ftpsClient.login(connectionManager.getUsername(),connectionManager.getpassword());
if(ftpsClient.isConnected()) {
ftpsClient.execPBSZ(0);
ftpsClient.execPROT("P");
ftpsClient.setEnabledSessionCreation(false); //If I set this to true then it throws exception:450 TLS session of data connection has not resumed or the session does not match the control connection
// ftpsClient.setNeedClientAuth(true);
// ftpsClient.setWantClientAuth(true);
// ftpsClient.setPassiveNatWorkaround(true);
ftpsClient.enterLocalPassiveMode();
}
ftpsClient.setSoTimeout(connectionManager.getSocketTimeout());
ftpsClient.setFileType(org.apache.commons.net.ftp.FTP.BINARY_FILE_TYPE);
ftpsClient.setFileTransferMode(org.apache.commons.net.ftp.FTP.BINARY_FILE_TYPE);
ftpsClient.addProtocolCommandListener(new ProtocolCommandListener() {
@Override
public void protocolReplyReceived(ProtocolCommandEvent arg0) {
log.info(arg0.getMessage());
}
@Override
public void protocolCommandSent(ProtocolCommandEvent arg0) {
log.info(arg0.getMessage());
}
});
}
处失败
sslSocket.startHandshake()
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)