Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 Jun : Re: TidUDPServer question

www.cryer.info
Managed Newsgroup Archive

Re: TidUDPServer question

Subject:Re: TidUDPServer question
Posted by:"Remy Lebeau (TeamB)" (no.spam@no.spam.com)
Date:Tue, 6 Jun 2006 16:29:55

"Jamie Dale" <j.dale@turboz.net> wrote in message
news:448607d8@newsgroups.borland.com...

> BTW, I don't use a timer in the server - Only the client to force
> it to read - Indy IdTCPClient doesn't have an OnExcute handler

It is not supposed to.  Indy is not an event driven library.

I would not recommend using a timer, though.  You should use a reading
thread instead.  Have a look at the source code for the TIdTelnet component
for an example.

> However each thread also has access to the main array of users etc
> which apparently is not a good idea as the array can become corrupt
> due to thread collision - I don't know how to get around this..

You need to provide a locking mechanism around the array, such as by using a
critical section or a mutex, in order to access the array in a thread-safe
manner.


Gambit

Replies:

In response to:

www.cryer.info
Managed Newsgroup Archive