I'm using Delphi XE7. I've never used Indy components before.
I found a very good tutorial from Embarcadero called Developing TCP/IP-based Server Applications using Indy Components. It shows a very good example using TidCmdTCPServer
and Command Handlers.
My problem is I did not understand how to construct a command. I couldn't find it in help files neither Indy homepage.
See the code below:
procedure TMyServer.InitializeCommandHandlers;
var
NewCmd: TIdCommandHandler;
begin
NewCmd := FCommandHandlers.Add;
NewCmd.Command := 'HEARTBEAT'; { Do not Localize }
NewCmd.OnCommand := CommandHEARTBEAT;
NewCmd.ExceptionReply.NumericCode := 550;
NewCmd.Description.Text := 'Syntax: HEARTBEAT'; { do not localize }
NewCmd.Disconnect := False;
NewCmd := FCommandHandlers.Add;
NewCmd.Command := 'COLOR'; { Do not Localize }
NewCmd.CmdDelimiter := #$20;
NewCmd.ParamDelimiter := '|';
NewCmd.OnCommand := CommandCOLOR;
NewCmd.ExceptionReply.NumericCode := 550;
NewCmd.Description.Text := 'Syntax: COLOR <sp> "GET | [SET" | color-"blue | red | yellow]"'; { do not localize }
NewCmd.Disconnect := False;
end;
The first command HEARTBEAT
is fairly easy, but the COLOR
command is not.
I didn't understand the line:
NewCmd.Description.Text := 'Syntax: COLOR <sp> "GET | [SET" | color-"blue | red | yellow]"'; { do not localize }
Can anyone explain how it is constructed? Or show me a document where I can learn this?
What "do not localize" means?