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

www.cryer.info
Managed Newsgroup Archive

Re: Intercept

Subject:Re: Intercept
Posted by:"Remy Lebeau (TeamB)" (no.spam@no.spam.com)
Date:Tue, 6 Jun 2006 10:08:57

"Massimo Bolzoni" <massimo.bolzoni@mandelli.com> wrote in message
news:44855677$1@newsgroups.borland.com...

> I need a log of the strings that comes; is it correct to use
> a TIdServerInterceptLogEvent component, linked in the
> Intercept property of the TIdTCPServer?

Only of the server-side logging intercepts will work.  Just keep in mind,
though, that TIdTCPServer is multi-threaded, so make sure any logging you do
is thread-safe.

> I tried it; in the OnLogString I write the text in a listbox (and see it)

Accessing the GUI from the context of a worker thread is not thread-safe.

> In the Execute procedure of the TIdTCPServer must I do
> something other thing about TIdServerInterceptLogEvent?

No.

> Is TIdServerInterceptLogEvent.OnLogString thread safe?

Intercepts are triggered in the context of the thread that is accessing the
socket.  You need to make sure that any code you put inside the logging
events are thread-safe.  In this situation, you will have to use the TIdSync
or TIdNotify class to synchronize access with the GUI.


Gambit

Replies:

none

In response to:

www.cryer.info
Managed Newsgroup Archive