我的代码用于连接到drivehq ftp客户端
FTPClient client = new FTPClient();
public boolean upload(File file){
client.enterLocalPassiveMode();
client.connect("ftp.drivehq.com");
client.login("username", "password");
client.enterLocalPassiveMode();
fis = new FileInputStream(file);
status= client.storeFile(" /c/"+file.getName(), fis);
client.logout();
fis.close();
}
并且我得到的错误消息是
java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:194)
at java.net.SocketInputStream.read(SocketInputStream.java:122)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:273)
at java.io.BufferedInputStream.read(BufferedInputStream.java:334)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:235)
at java.io.BufferedInputStream.read(BufferedInputStream.java:254)
at org.apache.commons.net.telnet.TelnetInputStream.__read(TelnetInputStream.java:114)
at org.apache.commons.net.telnet.TelnetInputStream.run(TelnetInputStream.java:535)
at java.lang.Thread.run(Thread.java:722)
我已经看到此代码在sep-2014中的一个视频中工作,但现在它无法正常工作?
答案 0 :(得分:0)
我不熟悉FTPClient类,但似乎以下行不正确:
NaN
请先测试一个带文件名的简单路径。