我设置了 SFTP 连接。我使用了 WinCSP 和 Filezilla,测试服务器运行没有问题。java代码来自apache commons-net 2.0
,它给了我意想不到的错误
代码
private String ftpServer="XXX.xx.x.XX";
private int ftpPort=99;
private String ftpUserName="myUserName";
private String ftpPassword="myPassword";
FTPSClient ftp = null;
try{
ftp = new FTPSClient();
ftp.connect(hostname, port)
} catch (Exception e){
Logger.debug(e)
}
堆栈跟踪
Server reply:SSH-2.0-WeOnlyDo-wodFTPD 2.3.6.165
org.apache.commons.net.MalformedServerReplyException: Could not parse response code.
at org.apache.commons.net.ftp.FTP.__getReply(FTP.java:315)
at org.apache.commons.net.ftp.FTP._connectAction_(FTP.java:364)
at org.apache.commons.net.ftp.FTPClient._connectAction_(FTPClient.java:540)
at org.apache.commons.net.ftp.FTPSClient._connectAction_(FTPSClient.java:167)
at org.apache.commons.net.SocketClient.connect(SocketClient.java:178)
at myHomeFtpService.getFtpConnection(HomeFtpService.java:40)