Connection reset by peer error - I'm stuck

Giganews Newsgroups
Subject: Connection reset by peer error - I'm stuck
Posted by:  Pete Fraser (
Date: Mon, 24 Nov 2003

I use the following C++ code to get files from a FTP server.
Sometimes I get a "Connection reset by peer error" which does not get
recovered from even after 10 retries which all fail.

FWIW, I get 10 copies of ThreadException FileName in the event log.

What is the correct way to recover?
Thanks, Pete

  bool Result = true;
  int Retry = 10;
        OutputDebugString(("Get file: "+FileName).c_str());
        FTPClient->Get(RemotePath+"/"+FileName, FileName, true);
    { // non existant file
        OutputDebugString(("Thread Exception"+FileName).c_str());
        Result = false;  // failed
  }while(!Result && --Retry);  // retry n times