🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.socket
Article #415

Re: Using TIdTCPServer

#415
From: Remy Lebeau (TeamB)
Date: Thu, 31 Jan 2008 22:03
27 lines
2521 bytes
"Peter" <piotrtrzeciak@yahoo.com> wrote in message 
news:47a23116$1@newsgroups.borland.com...

> When I do a very simple data send to the server, the sequence I get is:
> 1. onConnect handler is invoked (no code, just log entry)
> 2. onExecute handler is invoked (runs ok)
> 3. onExecute handler is invokes AGAIN.

That is normal behavior.

> I assume on the same socket connection.

Yes.  Use the TIdContext parameter to verify that.

> why is onExecute handler being invoked twice on the same socket 
> connection?

Because it is supposed to.  TIdTCPServer calls OnExecute in a continuous 
loop for the lifetime of the connection.  You have your OnExecute code set 
up to read a single command and then exit.  The server will loop around, 
call OnExecute again, read the next command (waiting as needed, raising an 
exception if error/disconnect occurs), exit, and repeat.  This is the 
preferred way to use TIdTCPServer, so you are fine.


Gambit 
Technical Details
Message-ID: <47a24592@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!lightspeed.eweka.nl!81.171.88.9.MISMATCH!ramfeed2.eweka.nl!eweka.nl!hq-usenetpeers.eweka.nl!194.97.5.5.MISMATCH!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <478e1c34$1@newsgroups.borland.com> <478e4760@newsgroups.borland.com> <4798a5e1$1@newsgroups.borland.com> <4798cf30$1@newsgroups.borland.com> <4798db8f$1@newsgroups.borland.com> <4798ef34$2@newsgroups.borland.com> <479e2c75$1@newsgroups.borland.com> <479e382e$1@newsgroups.borland.com> <479f4835$1@newsgroups.borland.com> <479f51f8$1@newsgroups.borland.com> <479f68b1$1@newsgroups.borland.com> <479f7070$1@newsgroups.borland.com> <479f9ae1$1@newsgroups.borland.com> <47a2265f$1@newsgroups.borland.com> <47a23116$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,452e664b18b0b56c
X-Google-Attributes: gid11508e,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.internet.socket
References: <478e1c34$1@newsgroups.borland.com> <478e4760@newsgroups.borland.com> <4798a5e1$1@newsgroups.borland.com> <4798cf30$1@newsgroups.borland.com> <4798db8f$1@newsgroups.borland.com> <4798ef34$2@newsgroups.borland.com> <479e2c75$1@newsgroups.borland.com> <479e382e$1@newsgroups.borland.com> <479f4835$1@newsgroups.borland.com> <479f51f8$1@newsgroups.borland.com> <479f68b1$1@newsgroups.borland.com> <479f7070$1@newsgroups.borland.com> <479f9ae1$1@newsgroups.borland.com> <47a2265f$1@newsgroups.borland.com> <47a23116$1@newsgroups.borland.com>
Subject: Re: Using TIdTCPServer
Date: Thu, 31 Jan 2008 14:03:42 -0800
Lines: 29
Organization: Lebeau Software
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198
NNTP-Posting-Host: 207.178.157.90
Message-ID: <47a24592@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1201816978 207.178.157.90 (31 Jan 2008 14:02:58 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!lightspeed.eweka.nl!81.171.88.9.MISMATCH!ramfeed2.eweka.nl!eweka.nl!hq-usenetpeers.eweka.nl!194.97.5.5.MISMATCH!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail