Telnet Factory for .NET

Rsh.Execute Method (String, String, String)

Executes a command on the Remote Host.

public byte[] Execute(
   string hostname,
   string username,
   string command
);

Parameters

hostname
The hostname or IP address of the Remote Host.
username
The username for the Remote Host.
command
The command to execute on the Remote Host.

Return Value

Result, as byte array, from Remote Host.

Example

This example returns the results of a directory listing command executed on the Remote Host. Substitute a valid Remote Host and user for the hostname and username parameters.

[C#]
Rsh rsh = new Rsh();
byte[] response  = rsh.Execute("hostname", "username", "ls -al");
string data = rsh.Encoding.GetString(response);
Console.WriteLine(data);

[Visual Basic]
Private WithEvents rsh As Rsh
rsh = New Rsh
Dim response As Byte() = rsh.Execute("hostname", "username", "ls -al")
Dim data As String = rsh.Encoding.GetString(response)
Console.WriteLine(data)

See Also

Rsh Class | Jscape.Telnet Namespace | Rsh.Execute Overload List