Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 May : Re: Indy Error ?

www.cryer.info
Managed Newsgroup Archive

Re: Indy Error ?

Subject:Re: Indy Error ?
Posted by:"Guillem" (guillemvicens-nospam@clubgreenoasis.com)
Date:8 May 2006 06:30:16

Mike C wrote:


>
> Also, if all the lbxLog.Item.Add() lines are commented out
>  then the error does not occur.
>
> I would be grateful if anyone can explain the cause of the
>  problem and suggest a solution.
>
> <snip code>

on first look there is a problem in your idTCPServerExecute handler in
the except part of the try..except. Do not forget that Indy servers are
multi-threaded. Whenever a client connects to the server, it creates a
thread that handles that connection. Basically it is as if you would
have 1 copy of the idTCPServerExecute for every thread. Therefore, if
you have 2 threads accessing the VCL (like your worker thread accessing
the ListBox) you will surely get nasty and unpredictable bugs.

You have to force synchronization. To do this you could for example use
Synchronize method (search for it in the Delphi help). There are other
options as for example rendez-vous messages, critical sections, mutex,
etc. It all depends on what you need.

Good luck
--
Best regards :)

Guillem Vicens Meier
Dep. Informatica Green Service S.A.
www.clubgreenoasis.com

Replies:

none

In response to:

www.cryer.info
Managed Newsgroup Archive