Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 Jun : Re: TIDCmdTCPServer

www.cryer.info
Managed Newsgroup Archive

Re: TIDCmdTCPServer

Subject:Re: TIDCmdTCPServer
Posted by:"Remy Lebeau (TeamB)" (no.spam@no.spam.com)
Date:Fri, 16 Jun 2006 10:17:32

"Roberto Colpani" <roberto.colpani@vetrariafratellicolpani.it> wrote in
message news:44924c64@newsgroups.borland.com...

> Thanks very much.

For future reference, please trim your replies.  Over-quoting the original
text is highly discouraged, especially when you quote a lot of text.  Trim
out everything you are not directly commenting on.

> On client side on the onconnect method I have this code:
>
> Now I have modify the code like so:

That is the completely wrong thing to do.  Indy is not an event-driven
library.  You should be calling SendCmd() after Connect() has exited.  Also,
you are not reading the server's Greeting after connecting.  So the
'RegisterUser' command is reading the Greeting reply, which is the wrong
reply for it to be reading in the first place, and then you are using a
separate call to GetResponse() to read the 'RegisterUser' reply.  You should
be reading the Greeting before sending any commands at all, ie:

    TangoClient.Connect;
    try
        TangoClient.GetResponse(200); // <-- read the Greeting first
        TangoClient.SendCmd('RegisterUser;' + UserName + ' ' +
ComputerName); // <-- SendCmd() will read the correct reply now
        //...

> with the TServerSocket with the SendText method I could send
> to every connected user some string;

The only way to do that was to loop through each connection individually.
TCP has no broadcasting capabilities.

> with the TIdCmdTcpServer how can I do the same things?

Loop through the connections that are stored in the server's Contexts
property.


Gambit

Replies:

none

In response to:

www.cryer.info
Managed Newsgroup Archive