I have a similar design, but I also have a pointer to the thread in the
THttpConnection so that the connection can set a flag on the thread if the
connection is dropped before the thread has finished the work and risk using
a freed connection.

This design could serve several connections/threads at the same time.

Regards Bjørnar 

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Guillaume MAISON
> Sent: 9. februar 2006 10:59
> To: ICS support mailing
> Subject: [twsocket] [QUESTION] ThttpServer and threading design
> 
> Hi everyone,
> 
> i've an application to write, a client and a server.
> i've choosen to use the HTTP protocol to enable communication 
> through them.
> Hence, i'll use the THttpServer as my server front-end.
> 
> my question is the following :
> some requests may use some database stuff (SQLite). It 
> shouldn't be the case, but, in case the SQL stuff may need 
> long duration (long>10 secs) i prefer to use threads to get 
> DB data, as there may be several clients connecting at the same time.
> 
> Am i right to implement such requests as this :
> Form.OnGetDocument :
>       Create a Thread with the HttpConnection attached and 
> FreeOnTerminate:=True;
>       Assign a OnThreadTerminate
>       Run the thread
>       Set Flags to hgWillSendMySelf
> 
> Form.OnThreadTerminate
>       AttachedHttpConnection.AnswerString/AnswerStream/AnswerWhatever
> 
> Does this design seem good ?
> i mean will i be able to serve several connections at the 
> same time (independantly of DB concurrential access that i'll 
> manage within thread context) ?
> 
> Thanks in advance for your help !
> 
> Regards,
> 
> 
> -- 
> 
> Guillaume MAISON - [EMAIL PROTECTED]
> 83, Cours Victor Hugo
> 47000 AGEN
> Tél : 05 53 87 91 48 - Fax : 05 53 68 73 50 e-mail : 
> [EMAIL PROTECTED] - Web : http://nauteus.com
> 
> --
> 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