Kinda lost!

Giganews Newsgroups
Subject: Kinda lost!
Posted by:  ClĂ©ment_Doss
Date: Tue, 03 Oct 2006

Hi,

I have changed my FTP client to a threaded FTP client, but there are some behaviour
that I am not understanding.

If I select more than 2 files, I most certainly will have a problem. Then program
starts the FTP, but just stops. When I check the server, there's a "Closed
connection. Transfer aborted". But the line *Synchronize(StatusEnd);* is not
executed, and I this thread remains active until the programs closes.
Of course, if I try to download one file things works, no matter if the files is
small 345 Kbytes or big 140 Mbytes.).

One thing I noticed. When there are big transfers (>80Mb), the thread "stops" for a
while (I guess inside FFTP.Get) then executes *Synchronize(StatusEnd);*. I am using
the default properties of TidFTP.Create with 2 or 3 threads. Above that, the
behaviour I described happens.

Is there a way to detect that the connection was closed by the server?
What can I possibly be messing up :S?

procedure TMyFTPThread.Execute;
begin
  inherited;
  try
    try
        FFTP.Connect;
        Synchronize(StatusDownloading);
        FFTP.Get( FFileRemote, FFileLocal, True , FFtp.ResumeSupported );
        Synchronize(StatusEnd); // <-- this is not executed, at least the main thread
is not updated with the new status
    except
      // should never arise
      Raise; // Debug only
    end;
  finally
    if FFtp.Connected then
        FFtp.Disconnect;
  end;
end;

Best regards,
Clément

Replies