FTPClient Uploading File = SocketException: Connection reset

后端 未结 3 1110
终归单人心
终归单人心 2021-02-06 02:07

I\'m trying to upload a simple txt file via FTP using XAMPP and FileZilla.
I\'m using the Apache Commons Net 3.0.1 Library.
This is my code, very basic things:



        
相关标签:
3条回答
  • 2021-02-06 02:20

    Set:

    client.setUseEPSVwithIPv4( true );

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

    0 讨论(0)
  • 2021-02-06 02:38

    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.

    0 讨论(0)
  • 2021-02-06 02:41

    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! :)

    0 讨论(0)
提交回复
热议问题