Rebex



Sample: WinFormRExec - GUI Remote Exec

SSH remote exec utility - executes a simple command at the SSH server.

WinFormRExec Screenshot

Connects to the specified SSH server, executes a single command and displays the command output in a TextBox control. The easiest way of response reading is utilized - check out the Reading command response tutorial for more information.

This sample demonstrates:

  • Using Ssh and Shell classes.
  • Sending a command to the server.
  • Reading a response from the server.

C#

// Handles the 'SendCommand' button click event 

// send the command using the ssh object initialized elsewhere (eg. in Form.Load event) 
Shell shell = ssh.StartCommand("dir");

// read the response of the command 
string response = shell.ReadAll();

// append the response to the some TextBox 
textBox.AppendText(response);

VB.NET

' Handles the 'SendCommand' button click event 

' send the command using the ssh object initialized elsewhere (eg. in Form.Load event) 
Dim shell As Shell = ssh.StartCommand("dir")

' read the response of the command 
Dim response As String = shell.ReadAll()

' append the response to the some TextBox 
textBox.AppendText(response)

See also: