🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: using TIdTCPServer

#3950
From: Simon Guertin
Date: Fri, 06 May 2005 19:42
39 lines
2443 bytes
Thank you for the explanation, I have one more question..
let's say that in this case, 5 clients connect at the same time.. I 
greet them in the OnConnect method..then in the execute.. I need to know 
who is the client..so I write on the socket a command and then I wait 
for the answer.. but is'nt the method iDTCPServerExecute will be called 
by many objects at the same time and change my local variables?
I need the store the client's retreived info in the Thread's Data object?

let's say I ask for a client name, then I return to him a private key.. 
and I then wait for a command from the client.. If this is not done from 
within the peerthread..how can I do that?

thanks

Simon

> 
> 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: <427bc89c$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!news-out.nntp.be!propagator2-sterling.newsfeeds.com!news-in.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <427a2a63$1@newsgroups.borland.com> <427a508e@newsgroups.borland.com> <427a6397@newsgroups.borland.com> <427a776d$1@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
Date: Fri, 06 May 2005 15:42:29 -0400
From: Simon Guertin <sguertin_AT@trellianetworks.com>
User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.internet.socket
Subject: Re: using TIdTCPServer
References: <427a2a63$1@newsgroups.borland.com> <427a508e@newsgroups.borland.com> <427a6397@newsgroups.borland.com> <427a776d$1@newsgroups.borland.com>
In-Reply-To: <427a776d$1@newsgroups.borland.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 67.71.74.98
Message-ID: <427bc89c$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1115408540 67.71.74.98 (6 May 2005 12:42:20 -0700)
Lines: 39
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!news-out.nntp.be!propagator2-sterling.newsfeeds.com!news-in.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail