本人用java连接ftp下载文件,但是连接时就报错了,具体行数是ftp.connect(“192.168.1.174”,22);
端口号是22时,异常为
org.apache.commons.net.MalformedServerReplyException:Could not parse response code.
Server Reply:SSH-2.0-OpenSSH_5.3
端口号为默认的21时,异常为
java.net.ConnectionException:Connection refused:connect
端口号是22时,异常为
org.apache.commons.net.MalformedServerReplyException:Could not parse response code.
Server Reply:SSH-2.0-OpenSSH_5.3
端口号为默认的21时,异常为
java.net.ConnectionException:Connection refused:connect
try { FTPClient ftp = new FTPClient(); ftp.connect("192.168.1.174",22); ftp.login("abc", "111"); int reply = ftp.getReplyCode(); if (!FTPReply.isPositiveCompletion(reply)) { ftp.disconnect(); return "success"; } } catch (IOException e) { e.printStackTrace(); } finally { if (ftp.isConnected()) { try { ftp.disconnect(); } catch (IOException ioe) {} } }
本人在网上找了一些,但是都没具体说明是什么原因
解决方案:40分
ftp服务器在哪
防火墙开了么
防火墙开了么