Thanks for the clarification. Let me explain my scenario. This application is an IP Surveillance software, where the server software is responsible for recording video from IP Cameras, so, to get the video it connects to the camera through the socket.
My software today is working on the following: Each camera instance has a working thread and a socket. The socket should get the data from the camera (This is done by the main thread, as Arno said, because of the assynchronous winsock API) and the working thread process the received data for each 30ms. This is working great but I´m doing some changes on the software structure, so, instead of having a working thread that parses the received data each 30ms, I would like to have this working thread to process the winsock messages, by doing this my code would be simpler because the parsing could the called directly from the OnDataAvailable event of TWSocket. So, one doubt that I have is, if I´m using a thread to process the socket messages using the MessageLoop procedure, all the TWSocket events like OnSessionConnected and OnDataAvailable is triggered using the thread context, right? So, my handle for those events should be working on the thread context? Thanks a lot!! Éric ----- Original Message ----- From: "Arno Garrels" <[EMAIL PROTECTED]> To: "ICS support mailing" <twsocket@elists.org> Sent: Monday, August 07, 2006 11:01 AM Subject: Re: [twsocket] Multithreaded Client Application Éric Fleming Bonilha wrote: > Hello, > > I´m writing a multi-threaded client application > > I read the ICS code and there is written that to make a real multi- > threaded application we should do ThreadAttach and use the > messageloop procedure on the execute method of the working thread. > I´m doing this, but, how do I stop this thread? How can I exit from > the loop to free the thread? There is written that the message > WM_QUIT should be sent, but to what handler? First of all, you don't need multi-threading by default for the socket I/O. ICS uses asynchron winsock API. If you want to process lengthy tasks the you should move that stuff in a workerthread and send the result when the thread finished. > There is written that the message > WM_QUIT should be sent, but to what handler? The message loop stopps, means function GetMessage() returns FALSE when it receives a WM_QUIT message. If yuo use TWSocket.MessageLoop you need to send it to the window handle (property Handle) of TWsocket (or property CtrlSocket). --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html -- 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