> back  data  to  wrong  client.  That  is why I know use an incremental
> SessionID  counter that I pass to worker to be sure to never send data
> back  to  wrong  socket  and  be  sure  to  always get unique ID among
> thousand of connections.

That's good. You can use the reference to find out if it is still in the 
clients list and if yes,
check the unique ID to see if it is still the same (a component may be freed 
and the exact same
address allocated to a new one. This one will of course have a new ID).

--
Contribute to the SSL Effort. Visit
http://www.overbyte.be/eng/ssl.html
--
[EMAIL PROTECTED]
Author of ICS (Internet Component Suite, freeware)
Author of MidWare (Multi-tier framework, freeware)
http://www.overbyte.be



----- Original Message ----- 
From: "Dod" <[EMAIL PROTECTED]>
To: "ICS support mailing" <[email protected]>
Sent: Thursday, February 09, 2006 2:37 PM
Subject: Re: [twsocket] [QUESTION] ThttpServer and threading design


> Hello Francois,
>
> Exactly  what  I do now, but what reference do you pass to thread ? At
> beginning  I  did  it with socket.handle (if I remember well by it was
> long  time  ago)  by  I  noticed that if during work job the socket is
> closed  and  a new connexion come, then it could happend that this new
> socket  get  same  handle as previous closed one so my worker may sent
> back  data  to  wrong  client.  That  is why I know use an incremental
> SessionID  counter that I pass to worker to be sure to never send data
> back  to  wrong  socket  and  be  sure  to  always get unique ID among
> thousand of connections.
>
> FP> That's what I do with my MidWare threaded TServerObject. You can apply 
> the same logic to the
> FP> HttpServer component.
>
> FP> I have a class which manage a pool of threads. When a request comes in, I 
> get a thread from
the
> FP> pool, adding a new one if necessary. The thread receive a reference to 
> the socket component ,
this
> FP> is important. The thread execute the lengthy database request and build 
> the response message
and
> FP> pass it to the main thread for sending it back to the client.
>
> FP> When the socket detect a session close, then it nullify the reference the 
> thread has so that
the
> FP> thread know it has to throw away any data or pass it back to the main 
> thread.
>
> FP> --
> FP> Contribute to the SSL Effort. Visit
> FP> http://www.overbyte.be/eng/ssl.html
> FP> --
> FP> [EMAIL PROTECTED]
> FP> Author of ICS (Internet Component Suite, freeware)
> FP> Author of MidWare (Multi-tier framework, freeware)
> FP> http://www.overbyte.be
>
> -- 
> To unsubscribe or change your settings for TWSocket mailing list
> please goto http://www.elists.org/mailman/listinfo/twsocket
> Visit our website at http://www.overbyte.be

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

Reply via email to