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 

FP> --
FP> Contribute to the SSL Effort. Visit
FP> http://www.overbyte.be/eng/ssl.html
FP> --
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

Reply via email to