Hello Guillaume, Ok so you do nearly same as me. But at the end of threaded job I verify the client still exists before sending result.
When a session connect I set a SessionID incremental counter in MySocketClient class because I noticed that same socket handle can be re-used by a next connection. So when I finish the job I just check if SessionID is still part of actual session's list. But setting a 'killed' value in working thread is also good. GM> 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. GM> What you're doing is transfering a socket from main thread context to your work thread context. GM> My purpose is not the following. What i mean is executing all the SQL stuff within the thread, GM> and the connection stuff within the main thread. When i meant "attaching the socket" it was not using the MultiThread GM> property or the De/AttachThread methods. i just meant attach the socket reference in order to be used in the OnThreadTerminate GM> 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 ? GM> if my purpose was to use socket within a thread context, this should be, yes, a constraint to take into account. GM> The design i provided in the first mail is meant precisely not to bother with such constraints. GM> From Bjornar suggestion, if the client connection is closed, then all that has to be done is to stop/terminate the worker GM> thread if active. GM> Regards, GM> -- GM> Guillaume MAISON - [EMAIL PROTECTED] GM> 83, Cours Victor Hugo GM> 47000 AGEN GM> Tél : 05 53 87 91 48 - Fax : 05 53 68 73 50 GM> 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
