FTPClient in a thread Issues?

Giganews Newsgroups
Subject: FTPClient in a thread Issues?
Posted by:  Brian (briangochnau…@yahoo.com)
Date: Thu, 09 Mar 2006

Is there any known or probable issues with running FTPClient in a thread?

I have some code that ran find under Indy10/D7 that now has an issue with 3/6 Dev Snap and D2005 and
I'm not getting get complete file, when it does a GET.

LIKE:
Main thread creates thread suspended then
ANewThreadCopyFile.Init then
AThreadCopyFileNewThread.Resume.

///////// THREAD UNIT excerpts //////

  TThreadCopyFile = class(TThread)
  private
    IdFTPLocal: TIdFTP;
    procedure GetFile;
  protected
    procedure Execute; override;
  public
    procedure Init;
  end;

procedure TThreadCopyFile.Init;
begin
  IdFTPLocal := TIdFTP.Create(nil);
  IdFTPLocal.Passive := true;
  IdFTPLocal.ProxySettings.ProxyType := fpcmNone;
  IdFTPLocal.Port := FTPServerPort;
  IdFTPLocal.ReadTimeout := 4000;
  IdFTPLocal.Username := 'norrischftp';
  IdFTPLocal.Password := 'Glavler8';
  IdFTPLocal.TransferType := ftBinary;
  IdFTPLocal.AutoLogin := true;
end;

procedure TThreadCopyFile.GetFile;
begin
  ...
    IdFTPLocal.Get(AFilename, LPath, true, false);  //AV error after most data get transferred
  ...
end;

Replies