Newsgroups : Borland : borland.public.delphi.internet.winsock : 2005 Jun : How to use TIdLogFile (Indy 10) in a thread?

www.cryer.info
Managed Newsgroup Archive

How to use TIdLogFile (Indy 10) in a thread?

Subject:How to use TIdLogFile (Indy 10) in a thread?
Posted by:"Elund Christensen" (nospamec@eegholm.dk)
Date:Fri, 10 Jun 2005 15:47:58

This code works fine:

begin
  Debug:=TIdLogFile.Create(Owner);
  Debug.Filename:= 'c:\temp\FTP_test_debug.log';
  Debug.Active:= true;
  DebugIOHandler:= TIdIOHandlerStack.Create(Owner);
  DebugIOHandler.Intercept:= Debug;

  FTPClient:=TidFTP.Create(Owner);

  FTPClient.IOHandler:=DebugIOHandler;

  FTPClient.Host:= '127.0.0.1';
  FTPClient.Username:= 'User';
  FTPClient.Password:= 'UserPassword';
  FTPClient.Connect;
end;

But when running in a thread using TCriticalSection there is no output in
the logfile and the communicaton to an FTP-Server does not work any longer.
I looks like that problem(s) has something to do with this line:

FTPClient.IOHandler:=DebugIOHandler;

When removing this line there are no communication problems to the
FTP-server.

Any suggestions for a solution on using TIdLogFile (Indy 10) in a thread?

Best regards,
Elund

Replies:

www.cryer.info
Managed Newsgroup Archive