Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 Aug : Re: TidCmdClient and TidCmdServer

www.cryer.info
Managed Newsgroup Archive

Re: TidCmdClient and TidCmdServer

Subject:Re: TidCmdClient and TidCmdServer
Posted by:"Remy Lebeau (TeamB)" (no.spam@no.spam.com)
Date:Tue, 15 Aug 2006 13:33:38

"Grant Brown" <grant@sitedoc.com.au> wrote in message
news:44e129b6@newsgroups.borland.com...

> Could someone explain how to use a TidCmdClient and a
> TidCmdServer to send commands to each other.

You don't, because they are not designed to be used together in the first
place.  They will deadlock each other.  If you want to handle commands on
just the server side, then you need to use TIdTCPClient and TIdCmdTCPServer
together.  If you want to handle commands on just the client side, then you
need to use TIdCmdTCPClient and TIdTCPServer together.  If you want to
handle commands on both the client side and the server side, then you
probably need to re-think your design.  What EXACTLY are you trying to
accomplish?

> With each command set from the client I need to be able to also
> send some simple string variables so the command server can use
> them in its OnCommand procedure.

Use SendCmd() on the client side, and put the values as delimited parameters
of the command string, ie:

    Client.SendCmd('COMMAND param1 param2 param3 etc');

On the server side, the OnCommand event handler can use the
ASender.UnparsedParams property to get the raw data as 'param1 param2 param3
etc'.  Or set the TIdCommandHandler.ParseParams prperty to True and then use
the ASender.Params property in the OnCommand event handler.

> Does anyone have a simple demo project that I could have a look at

Have you looked at Indy's own demos yet?


Gambit

Replies:

none

In response to:

www.cryer.info
Managed Newsgroup Archive