Thanks to all for answers. I'm going to change my source code to take care of yours advices.
Engi > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Francois PIETTE > Sent: Friday, June 29, 2007 6:10 PM > To: ICS support mailing > Subject: Re: [twsocket] TWSocketServer in thread > > > My program works with the main form and 3 threads (A, B & C). > > Two of this threads (A & B) are created by main form and > the third (C) > > is created by thread A. > > > > Each thread create, run and destruct a server (TWSocketServer) in > > Execute() > > method. > > > > For thread A and B, my client application tcp/ip connections are ok. > > But the server in thread C don't answer to requests. > > > > My client can connect to it, that's all. Even the banner is > not sent. > > I don't know if it is your problem, but here is my analysys: > 1) You don't create TWSocketServer from the Execute method in > each thread. > You probably create TWSocketServer in thread's > construcotr or even the main form. > 2) Your threads lacks a message pump > 3) By Windows design, all message based events are handle in > the thread context in which the component was created/. > > Given that, the TWSocketServer in threads A and B are working > because their events are executed by the main threads (that > it the tread context when the component where created). > TWSocketServer in thread C doen't work because it is created > in the context of thread A which lacks a message pump. > > The solution: > Create all TWSocketServer in the begining of each thread's > Execute method. > Add a message pump in each of your thread (there is one > message pump in TWSocketServer you can use it). > > > But wait ! There is probably an even better solution: do not > use thread at > all ! ICS component are asynchronous and will multitask > without using any > thread. You only need multithreading if your dataprocessing > require lengthy > computation or use other blocking components (for example lengthy SQL > request). > > If you still think you need threads, see the samples provided > with ICS-V5 > (ThrdSrv.dpr and others). > > Contribute to the SSL Effort. Visit > http://www.overbyte.be/eng/ssl.html > -- > [EMAIL PROTECTED] > The author of the freeware multi-tier middleware MidWare > The author of the freeware Internet Component Suite (ICS) > 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 > > > __________ NOD32 2363 (20070629) Information __________ > > This message was checked by NOD32 antivirus system. > http://www.eset.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