Dod a écrit : > Hello Guillaume, > > Until know what I use to do is to create a worker thread and send jobs > (with pointer to socket client object) and then worker send back a > message to socket thread with pointer of data to send back to client. > So all socket things is done from same thread. > Dettaching clientsocket from socket thread to attach it into worker > thread when starting lenghty operation is something I never did.
What you're doing is transfering a socket from main thread context to your work thread context. My purpose is not the following. What i mean is executing all the SQL stuff within the thread, and the connection stuff within the main thread. When i meant "attaching the socket" it was not using the MultiThread property or the De/AttachThread methods. i just meant attach the socket reference in order to be used in the OnThreadTerminate event (which is in the main thread). > I have one question regarding this... if some socket event come during > the lengthly operation (OnDisconnect or OnDataAvailable for example), > will they be triggered during operation or only at end of it ? > If socket is MultiThread:=true it should use its own message queue so > react instantly whenever the thread it is attached into is busy isn't > it ? if my purpose was to use socket within a thread context, this should be, yes, a constraint to take into account. The design i provided in the first mail is meant precisely not to bother with such constraints. From Bjornar suggestion, if the client connection is closed, then all that has to be done is to stop/terminate the worker thread if active. 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