TIdFTP timeout on Read after completion of large (20 mb) uploads! help!

Giganews Newsgroups
Subject: TIdFTP timeout on Read after completion of large (20 mb) uploads! help!
Posted by:  m (nobo…@nowhere.com)
Date: Thu, 6 May 2004

i am using delphi 5 with indy 9.0.11.

when i use TidFTP to upload large files (20 mb+), the upload doesn't
complete properly.

the only reason it didn't hang was a readtimeout i set.

smaller (12.7 mb, 8.9 mb, 15.9 mb) files ok

i'm using binary file transfer mode and uploading a exe file.

server is ProFTPD 1.2.9 Server.

Starting FTP transfer
Transfer complete
(error here:  read timeout)
Disconnecting.
Disconnected.

procedure TIdFTP.InternalPut(const ACommand: string; ASource: TStream;
AFromBeginning: Boolean = true);
var
  LIP: string;
  LPort: Integer;
  LResponse: Integer;
begin
...(snip)...
  // 226 = download successful, 225 = Abort successful}
  LResponse := GetResponse([225, 226, 250, 426, 450]);  ***1
  if (LResponse = 426) or (LResponse = 450) then begin
    // some servers respond with 226 on ABOR
    GetResponse([226, 225]);
    DoStatus(ftpAborted, [RSFTPStatusAbortTransfer]);
  end;
end;

procedure TIdTCPConnection.GetInternalResponse;
var
  LLine: string;
  LResponse: TStringList;
  LTerm: string;
begin
  LResponse := TStringList.Create; try
    LLine := ReadLnWait;  ***2
    LResponse.Add(LLine);
    if Length(LLine) > 3 then begin
      if LLine[4] = '-' then begin // Multi line response coming
        LTerm := Copy(LLine, 1, 3) + ' ';
{We keep reading lines until we encounter either a line such as
"250" or "250 Read"}
        repeat
          LLine := ReadLnWait;
          LResponse.Add(LLine);
until (Length(LLine) < 4) or (AnsiSameText(Copy(LLine, 1, 4),
LTerm));
      end;
    end;
    FLastCmdResult.ParseResponse(LResponse);
  finally FreeAndNil(LResponse); end;
end;

i observed it with the only two servers i tried it with:  win 2000 server
and the free bsd server.

somebody help!

thanks
mp

remove "nowhere." from my e-mail address to contact me.

Replies