Executes a command on the Remote Host.

Namespace: Jscape.Telnet
Assembly: Jscape.Telnet (in Jscape.Telnet.dll) Version: 2.6.1.0

Syntax

C#
public byte[] Execute(
	string hostname,
	string username,
	string command
)
Visual Basic
Public Function Execute ( _
	hostname As String, _
	username As String, _
	command As String _
) As Byte()
Visual C++
public:
array<unsigned char>^ Execute(
	String^ hostname, 
	String^ username, 
	String^ command
)

Parameters

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

Return Value

Result, as byte array, from Remote Host.

Examples

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.
CopyRsh Execute
Rsh rsh = new Rsh();
byte[] response  = rsh.Execute("hostname", "username", "ls -al");
string data = rsh.Encoding.GetString(response);
Console.WriteLine(data);

CopyRsh Execute
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