Handling "Connection reset by peer" error in an FTP client
Asked Answered
E

1

5

I have a Java program that calculates some stats daily and uploads the file on a server through FTP. However, I get "Connection reset by peer" errors way too often.

Since I cannot change the server configurations, what are the recommended ways to handle such types of errors? How can I make sure that the whole file is transferred to the server?

Estradiol answered 13/7, 2012 at 18:1 Comment(0)
A
7

The message "Connection reset by peer" means the server closed the connection. The cause could be a TCP timeout, a lack of disk space, ETC.

  1. Try transferring the file using FTP without using Java, using a command line utility.
    If the same problem occurs, it is definitely not the Java program.
  2. Make sure the network is not sensitive to the size of file(s) being transferred.
  3. Make sure the server is not blocking connections from your client after it has already made "N" previous connections or after a certain length of time, E.G. 20 minutes.
  4. See if your client can establish a persistent TCP connection using another protocol: SSH, etc.
    If the problem occurs with the other protocol also, it's likely to be the network.


If you find the issue is caused by a timeout that would only happen if your connection was idle too long, then check this URL:

FTP: "Connection reset by peer"

Anestassia answered 13/7, 2012 at 18:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.