Indy 9 | Content | Index | Reference

TIdRemoteCMDClient
Hierarchy, Properties, Methods, Events, See Also, Unit: IdRemoteCMDClient
TIdRemoteCMDClient is an ancestor to TIdRexec and TIdRSH.

    TIdRemoteCMDClient = class(TIdTCPClient)

Unit
IdRemoteCMDClient
Description
TIdRemoteCMDClient is an ancestor to TIdRexec and TIdRSH to accommodate some common properties and behaviors shared by those components. The behaviors shared include:

- The usage of a StdError port (TIdRemoteCMDClient.UseStdError)

- The server error handling is the same (TIdRemoteCMDClient.ErrorReply, TIdRemoteCMDClient.ErrorMessage)

- Command requests involve the same code except that the two parameters for authentication are different.

- Both protocols are used for executing commands on a remote server.

TIdRemoteCMDClient.ErrorMessage
TIdRemoteCMDClient, See Also
This is the error message that was returned from the Rexec or RSH Deamon.

    property ErrorMessage: String;

Description
This is the error message that was returned from the Rexec or RSH Deamon and this property is only if TIdRexec.Execute or TIRSH.Execute failed and TIdRemoteCMDClient.ErrorReply is True.

TIdRemoteCMDClient.ErrorReply
TIdRemoteCMDClient, See Also
This indicates if the RSH or Rexec Deamons returned an error.

    property ErrorReply: Boolean;

Description
This indicates if the RSH or Rexec Deamons returned an error. The error can be obtained with the TIdRemoteCMDClient.ErrorMessage.

TIdRemoteCMDClient.UseStdError
TIdRemoteCMDClient, See Also
This property indicates if TIdRexec or TIdRSH should use a StdError port with the server.

    property UseStdError: Boolean;

Description
This property indicates if TIdRexec or TIdRSH should use a StdError port with the server. If this is set to True, the client listens on a port for a connection from the daemon and the server connects and uses that port to send any error messages. If this is false, the server sends error information through the main connection. The reason that StdError ports are used is that Rexec and RSH are primarily Unix-centered and Unix programs often use a StdError pipe and that data had to be treated separately from non-error related output.

The TIdRemoteCMDClient.ErrorReply and TIdRemoteCMDClient.ErrorMessage properties are not effected by this property at all.

If the user is behind a firewall, the TIdRemoteCMDClient.UseStdError property should be set to false because a connection to a Rexec or RSH daemon may fail if it can not connect to a user's StdError port.

TIdRemoteCMDClient.Create
TIdRemoteCMDClient, See Also
Constructor for the object instance.

    constructor Create(AOwner: TComponent); override;

Parameters
AOwner: TComponent
Owner of the object instance.
Description
Create is the constructor for the object instance. Create calls the inherited Create method and uses AOwner as the owner of the component. Create assigns IDRemoteFixPort as the default value for the UseReservedPorts property. Create also assigns IDRemoteUseStdErr as the default value for the UseStdError property.

TIdRemoteCMDClient.Destroy
TIdRemoteCMDClient, See Also
Frees the object instance.

    destructor Destroy; override;

Description
Destroy is the destructor for the object instance. Destroy calls the inherited Destroy method prior to exiting.

TIdRemoteCMDClient.Execute
TIdRemoteCMDClient, See Also
This is an abstract method that is overridden in descendant classes.

    function Execute(ACommand: String): String; virtual;

Parameters
ACommand: String
The command to execute on the remote system.
Return Value
String - Descendant classes return the results from the command that was executed or no value if an error occurred. In TIdRemoteCMDClient.Execute, this simply returns a blank string.
Description
This is an abstract method that is overridden in descendant classes. TIdRexec and TIdRSH override this will a function that calls an internal protected method called InternalExec passing the two authentication parameters required by the respective protocols. We do the coding this way because RSH uses the user's local User ID and the user's User ID on the remote host as part of it's authentication while Rexec requires the user's User ID on the remote machine and the password for authentication.

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