FTPClient Uploading File = SocketException: Connection reset

不想你离开。 提交于 2019-12-03 06:29:01

Solved by running this as administrator in the command prompt:

netsh advfirewall set global StatefulFTP disable

This is a Java 7 bug on Windows machines, it is reported here.

I'm honestly not sure but you should try the following:

Use something like the following code:

System.out.println(client.getReplyCode());
for(String s : client.getReplyStrings())
    System.out.println(s);

after client.login("user", "password"); to verify the status of your connection.

If you don't get any good hints from the code above, after invoking client.storeFile("textfile.txt", in); try to add client.completePendingCommand();.

Good luck! :)

Set:

client.setUseEPSVwithIPv4( true );

This works if you can't make changes to Window's firewall settings.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!