Re: Problems with TIdFtp

Giganews Newsgroups
Subject: Re: Problems with TIdFtp
Posted by:  Remy Lebeau (TeamB) (no.spam@no.spam.com)
Date: Fri, 15 Apr 2005

"Staffan Bergbom" <Staffan.Bergb…@lm.se> wrote in message
news:EF44C03223C7E240Staffan.Bergb…@lm.se...

>    if frmDataMessengerFtpMain.ActivateLogging.Checked then

That is not thread safe.  Use Synchronize().

>    WaitMessage;
>
>    getmessage(TmpMsg,0,0,0);

You are not checking for errors.

>      if not FSQLConnection.Connected then
>
>        if not ConnectToDatabase then Continue;

Is your DB code thread-safe?

>          FIdFTP.Abort;

Don't call Abort() unless you are in the middle of a transfer.  Which is
impossible in this code since the thread is blocked during a transfer to
begin with.

>          FIdFTP.Disconnect;
<snip>
>          if FIdFTP.Connected then

That should never happen.

> --------At this point the polling timer don't seem to get enabled any more

That suggests that your own code is faulty, for not posting the message to
the main thread to begin with.  You are probably not protecting your thread
for errors adaquately enough.

Gambit

Replies

In response to

Problems with TIdFtp posted by Staffan Bergbom on Fri, 15 Apr 2005