Indy 9
TIdCommand
Hierarchy, Properties, Methods, See Also, Unit: IdTCPServer
Represents a command to be executed for a threaded peer connection.
TIdCommand = class(TObject)
Unit
IdTCPServer
Description
TIdCommand is class used to represent information about commands received by a TCP server for an exuting peer thread, and handled using a TIdCommandHandler. TIdCommand provides a flexible mechanism for implementing use of command parameters and command responses using command handlers in a multi-thread environment.

TIdCommand provides properties that identify the Thread generating the command, and the CommandHandler used to service the command. In addition, TIdCommand also implements methods that allow assigning the response for the command, and a mechanism for sending the command reply using the Thread connection that generated the command request.

TIdCommand instances are created in TIdCommandHandler.Check when a given command can be handled by the CommandHandlers for the server, using the peer thread that is executed in the Server context.


TIdCommand.CommandHandler
TIdCommand, See Also
Represents the command handler that generated the object instance.
property CommandHandler: TIdCommandHandler;
Description
CommandHandler is a read-only TIdCommandHandler property that represents the command handler that created the TIdCommand object instance. CommandHandler is assigned when the object instance is created as the peer thread is executed in TIdCommandHandler.Check. CommandHandler provides access to the TIdCommandHandler properties that indicates the Command string executed by the peer thread, delimiters for both the command and optional parameters, and reply content and exception codes.

TIdCommand.Params
TIdCommand, See Also
Contains parsed parameter values for the command object.
property Params: TStrings;
Description
Params is a read-only TStrings property that contains parameters parsed from UnparsedParams using the parameter delimiter specified by the command handler. When the command handlers indicates that parameters should be parsed, each parameter is added to Params as an individual line. Otherwise, all parameters appear on a single line in Params.

UnparsedParams can be used to access the parameter values before parsing was performed.


TIdCommand.PerformReply
TIdCommand, See Also
Indicates that the Reply should be sent to the peer prior to the response.
property PerformReply: Boolean;
Description
PerformReply is a Boolean property that indicates if the TIdRFCReply values in Reply should be sent to the peer connection using SendReply. PerformReply is examine after success completion of the command, and when an exception is raised. Set PerformReply to False to prevent transmission of the TIdRFCReply to the peer connection prior to the values in Response.

TIdCommand.RawLine
TIdCommand
Text data read from an executing client connection.
property RawLine: string;
Description
RawLine is a read-only String property that represents the unparsed text values read from the threaded client connection, and provided to a TIdCommandHandler when the thread is executed. RawLine is used by a TIdCommand that implements the action performed by the command handler to parse values that are stored in the Command, UnparsedParams, and Params properties of the object instance.

TIdCommand.Reply
TIdCommand, See Also
Contains the numeric and text content of an RFC reply .
property Reply: TIdRFCReply;
Description
Reply is a TIdRFCReply property that contains the NumericCode and Text that makes up an RFC response message. Reply is given the value in the ReplyNormal property of the command handler, when it is created by the command handler.

Reply can be altered if an exception is raised during execution of the command. After an exception is raised, Reply will contain the ReplyExceptionCode, from either the server or the command handler that raised the exception, and the exception text.

Reply is sent to the peer connection prior to the Response for the command handler when PerformReply is True.


TIdCommand.Response
TIdCommand, See Also
Contains the command response for the client connection.
property Response: TStrings;
Description
Response is a TStrings property that contains values to send as the command response to the peer connection using WriteRFCStrings. Response values, when present, are sent to the peer connection following any content in the Reply for the command. When Respond contain no values, it is ignored.

TIdCommand.Thread
TIdCommand, See Also
Represents the thread of execution for the peer connection in the command.
property Thread: TIdPeerThread;
Description
Thread is a read-only TIdPeerThread property that represents the thread of execution for the peer connection generating the TIdCommand. Thread provides a mechanism for sending the command reply and response to the peer connection. Thread also allows access to properties and methods of the server in the thread of execution using the Server property.

Thread is assigned when the TIdCommand instance is created by the command handler for the executing thread.


TIdCommand.UnparsedParams
TIdCommand, See Also
Represents the unparsed parameter values for the command object.
property UnparsedParams: string;
Description
UnparsedParams is a read-only String property that represents the unparsed parameter values received by the command handler that generated the command object. UnparsedParams is assigned when the command object is created by a command handler for the current thread of execution.

UnparsedParams is used to determine the values added to the Params property when the command handler creates the object instance.


TIdCommand.Create
TIdCommand, See Also
Constructor for the object instance.
constructor Create; virtual;
Description
Create is the Constructor for the object instance. Create relies on the inherited Create method to initialize properties in the object instance. Create also initializes the object instances used in the Params, Reply, and Response properties.

TIdCommand.Destroy
TIdCommand, See Also
Frees the object instance.
destructor Destroy; override;
Description
Destroy is the Destructor for the object instance. Destroy frees resources allocates in the Create constructor prior to calling the inherited Destroy method.

TIdCommand.SendReply
TIdCommand, See Also
Sends the contents of the RFC reply to the peer connection.
procedure SendReply;
Description
SendReply is a procedure used to send the generated content of the TIdRFCReply values in Reply to the peer connection using WriteRFCReply. When the command is executed, SendReply is called prior to transmitting the values in Response to the peer connection, but only when PerformReply is True. SendReply sets the PeformReply property to False prior to writing the RFC reply to the peer connection.

TIdCommand.SetResponse
TIdCommand, See Also
Assigns values to the Response property
procedure SetResponse(AValue: TStrings);
Parameters
AValue: TStrings
Values to assign to the Response property.
Description
SetResponse is a procedure used to assigns the values in AString to to the Response property.

Created with Doc-O-Matic 2 donated to Project JEDI. Commercial license available from the Doc-O-Matic site.