You have an OnClientConnect event which might be used to do things at 
connection time. Probably you can use it to attach to a worker thread.

In any case, you have to verify the the client socket (THttpConnection) 
doesn't do anything which is not threadsafe.

Another way is to let the HTTP server component handle everything in his own 
thread (usually the main threads but you can change that) and create worker 
thread only to process requests to serve OnGetDocument event and the likes. 
You can send the answer later, for example when the thread terminate (or is 
returned to a thread pool).

--
[EMAIL PROTECTED]
The author of the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
http://www.overbyte.be


----- Original Message ----- 
From: "Bjørnar Nielsen" <[EMAIL PROTECTED]>
To: "ICS support mailing" <twsocket@elists.org>
Sent: Tuesday, March 25, 2008 11:56 AM
Subject: Re: [twsocket] Cathing window messages for HttpSrv


I'm using PostThreadMessage to send messages to my thread, but I want to 
interrupt messages that is intended to go to a WSocket-component.

The reason is that I'm trying to make my HTTPSrv multithreaded. My idea was 
to intercept Do_FD_ACCEPT, pause the socket, send a custom message to 
another thread where I attach the socket and continue with Do_FD_ACCEPT. Is 
this a good way to achieve this? Or has anyone here achieved this in another 
way?

Regards Bjørnar

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On 
Behalf Of Arno Garrels
Sent: 19. mars 2008 10:52
To: ICS support mailing
Subject: Re: [twsocket] Cathing window messages for HttpSrv

Bjørnar Nielsen wrote:
> I'm using the THttpSrv in a thread, and want to catch the windows
> message to the server. How is this possible?

It's safe to use PostThreadMessage() for those custom messages,
however you must check for msg.Hwnd = 0 in your message pump
otherwise you risk conflicts with the message-ID numbers ICS v6
uses internally.

>
> My messagepump int the execute of the thread is like this:
>
> while(!Terminated && GetMessage(&msg, 0, 0, 0))
>
> {
>
>    switch(msg.message)
>
>    {
>
>        case WM_CUSTOM_SET_SERVER_SETTINGS:
>
[..]

> How can I catch FD_ACCEPT and other messages and get the receiving
> control for this message? I Use ICS V6 and don't understand how the
> TIcsWndHandler works. Does anyone have examples for this?

You could override the WndProc() procedure of a component and trap
FMsg_WM_ASYNCSELECT. Have a look at TCustomWSocket.WMASyncSelect()
for an example of how to catch FD_ACCEPT.

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html






>
>
>
>
> Regards Bjørnar
>
>
> No virus found in this outgoing message.
> Checked by AVG.
> Version: 7.5.519 / Virus Database: 269.21.7/1332 - Release Date:
> 17.03.2008 10:48
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

No virus found in this incoming message.
Checked by AVG.
Version: 7.5.519 / Virus Database: 269.21.7/1334 - Release Date: 18.03.2008 
20:52


No virus found in this outgoing message.
Checked by AVG.
Version: 7.5.519 / Virus Database: 269.22.0/1341 - Release Date: 24.03.2008 
15:03

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be 

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to