Newsgroups : Borland : borland.public.delphi.internet.winsock : 2008 Feb : Re: Encrypted command from server for TIdCmdTCPClient
| Subject: | Re: Encrypted command from server for TIdCmdTCPClient |
| Posted by: | "Jamie Dale" (jamie.da..@yahoo.com) |
| Date: | Thu, 14 Feb 2008 14:05:04 |
"Moore" <moore@hotmail.com> wrote in message
news:47b3f844$1@newsgroups.borland.com...
> How to make this with TIdCmdTCPClient? define a command named DEVDEL and
> make the adecuate parsing and retrieving in the OnBeforeCommand event?
> waht if the command is not DEVDEL, it is DEVADD for example?
> thnx a lot for your help..
As Remy has said, decrypt in the OnBeforeCommand event. Assuming it's Indy
10 you are using, the received data is a Var so it will be passed back to
the Indy code when you have finished with it.
Also, you need to ensure you have a delimiter character in the string. EG
you are sending DEVDEL0123 where DEVDEL is the command. The CommandHandlers
will only process the command DEVDEL if it matches what it is looking for -
In other words, it will not recognise DEVDEL0123 if you have a
commandhandler setup as 'DEVDEL'. You need to use a delimiter character such
as a colon, comma, or any other symbol you won't be using in your protocol
and which won't be typed. I typically use this symbol '¦' EG: 'DEVDEL¦0123'
You can set the Command and parameter delimiters in the object inspector for
each command.
When the received data is processed, it will look for the command &
parameter delimiters and parse everything either side of that symbol. In
other words, it will extract DEVDEL as the command, and then 0123 as a
parameter passed with it. You can even pass multiple parameters - EG
'DEVDEL¦0123¦LOGON'
The Indy server will then check the Command against all the commands you
have set in the program. If it finds DEVDEL then it will execute the
associated code which you have written for that command handler.
Hope that helps!
Jamie