Article View: borland.public.cppbuilder.internet.socket
Article #3942Re: using TIdTCPServer
From: Remy Lebeau (TeamB)
Date: Thu, 05 May 2005 19:45
Date: Thu, 05 May 2005 19:45
39 lines
2386 bytes
2386 bytes
"Simon Guertin" <sguertin_AT@trellianetworks.com> wrote in message
news:427a6397@newsgroups.borland.com...
> I would have like to have all my processing code in another class.
Then do so. There is nothing preventing you from doing that.
> This class will takeover the client communication since it is
> not really the best place to take care of that in the event of
> TIdTCPServer OnExecute Event.
Why not? Please elaborate.
> By processing everything in the OnExecute Method, it will not
> be good programming practice I beleive. I think the way the
> Java class handles the client connexion is a good way of OO
> programming.
Your Java code is not doing anything that cannot be done in Indy as well.
For example:
procedure TForm1.IdTCPServer1Connect(AThread: TIdPeerThread);
begin
AThread.Connection.WriteLn('whatever your greeting is');
end;
procedure TForm1.IdTCPServer1Execute(AThread: TIdPeerThread);
var
inputLine, outputLine: String ;
begin
inputLine = AThread.Connection.ReadLn;
//...
AThread.Connection.WriteLn('whatever your response is');
if (should disconnect) then AThread.Connection.DisconnectSocket;
end;
Gambit
Technical Details
Message-ID:
<427a776d$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news2.google.com!proxad.net!news.wiretrip.org!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!uio.no!uninett.no!news.net.uni-c.dk!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!news-in.nuthinbutnews.com!news-in.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<427a2a63$1@newsgroups.borland.com> <427a508e@newsgroups.borland.com> <427a6397@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,2b2bb416a158f43e 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: <427a2a63$1@newsgroups.borland.com> <427a508e@newsgroups.borland.com> <427a6397@newsgroups.borland.com> Subject: Re: using TIdTCPServer Date: Thu, 5 May 2005 12:45:30 -0700 Lines: 41 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: <427a776d$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1115322221 68.69.17.41 (5 May 2005 12:43:41 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news2.google.com!proxad.net!news.wiretrip.org!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!uio.no!uninett.no!news.net.uni-c.dk!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!news-in.nuthinbutnews.com!news-in.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail