Article View: borland.public.cppbuilder.internet.socket
Article #4146Re: TIdTCPServer OnExecute event
From: Remy Lebeau (TeamB)
Date: Wed, 23 Mar 2005 19:19
Date: Wed, 23 Mar 2005 19:19
23 lines
2120 bytes
2120 bytes
"Evandro Dugnani" <edugnani@gmail.com> wrote in message news:4241b3e4@newsgroups.borland.com... > I think now I get it... each client connection will "create" a > thread in server that will be in loop until connection be closed... > So, I will have same piece of code in different threads (OnExecute > event code) with Read() and Write() commands to communication > with client obeying a "logical protocol" defined by me... is that right? Yes. Keep in mind that since the OnExecute event is already looped inside of the server, your own OnExecute code should not be running any kind of "while(!Terminated)" or "while(Connected)" kind of loops. When the event is triggered, read/write a packet, then send/receive a response if needed, and then exit. When the event is triggered again, process the next packet, and so on. Each triggering of the event should handle a single logical operation (if you have to read/write several packets to complete the operation, that is ok). Gambit
Technical Details
Message-ID:
<4241c0e8@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!newshub.sdsu.edu!newshosting.com!nx01.iad01.newshosting.com!news-out.nntp.be!propagator2-sterling.newsfeeds.com!news-in.nuthinbutnews.com!news-in.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<424085cd@newsgroups.borland.com> <424096cf$1@newsgroups.borland.com> <42415376$1@newsgroups.borland.com> <4241ac0f$1@newsgroups.borland.com> <4241b3e4@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,2ec4d6e5445fd698 X-Google-Attributes: gid11508e,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> Newsgroups: borland.public.cppbuilder.internet.socket References: <424085cd@newsgroups.borland.com> <424096cf$1@newsgroups.borland.com> <42415376$1@newsgroups.borland.com> <4241ac0f$1@newsgroups.borland.com> <4241b3e4@newsgroups.borland.com> Subject: Re: TIdTCPServer OnExecute event Date: Wed, 23 Mar 2005 11:19:06 -0800 Lines: 25 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1409 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 NNTP-Posting-Host: 68.69.17.41 Message-ID: <4241c0e8@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1111605480 68.69.17.41 (23 Mar 2005 11:18:00 -0800) Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!newshub.sdsu.edu!newshosting.com!nx01.iad01.newshosting.com!news-out.nntp.be!propagator2-sterling.newsfeeds.com!news-in.nuthinbutnews.com!news-in.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail