Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 Aug : Re: Threads and Sessions.
| Subject: | Re: Threads and Sessions. |
| Posted by: | "York" (offi..@onlinebg.info) |
| Date: | Thu, 31 Aug 2006 16:02:48 |
could use a custom thread class. (I do this with Indy9 but hope you can do
the same with indy10)
In your custom threadclass could add a reference to the datamodule
It is then available in the OnExecute
Indy9 - idServer.ThreadClass := TMyPeerThread
where TMyPeerThread = class(TidPeerThread)
Hope this helps
Regards
"Massimo Bolzoni" <massimo.bolzoni@mandelli.com> wrote in message
news:44f6dc5c$1@newsgroups.borland.com...
>
> "Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message
> news:44f5c8f0$1@newsgroups.borland.com...
>>
>> "Massimo Bolzoni" <massimo.bolzoni@mandelli.com> wrote in message
>> news:44f54450@newsgroups.borland.com...
>>
>>> In this Execute method a DataModule instance
>>> is created, used to get various data, and destroyed
>>> at the end of the method. The data are written on
>>> the connection to the requesting CGI.
>>
>> I would suggest creating the DataModule instance in the OnConnect event,
>> and
>> destroy it in the OnDisconnect event. OnExecute is triggered in a loop.
>> Constantly creating/dropping database connections is not very efficient.
>>
>>
>> Gambit
>>
> Thanks, Remy, but I don't understand what "OnExecute is triggered in a
> loop"
> means. If I create the DataModule instance in the OnConnect event, how can
> I
> retrieve the reference to it in the OnExecute? Many clients can connect to
> the server
> simultaneously!
> Thanks, Massimo.