C# Класс Renci.SshNet.SshClient

Provides client connection to SSH server.
Наследование: BaseClient
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
AddForwardedPort ( ForwardedPort port ) : void

Adds the forwarded port.

CreateCommand ( string commandText ) : SshCommand

Creates the command to be executed.

CreateCommand ( string commandText, Encoding encoding ) : SshCommand

Creates the command to be executed with specified encoding.

This method will change current default encoding.

CreateShell ( Encoding encoding, string input, Stream output, Stream extendedOutput ) : Shell

Creates the shell.

CreateShell ( Encoding encoding, string input, Stream output, Stream extendedOutput, string terminalName, uint columns, uint rows, uint width, uint height, uint>.IDictionary terminalModes ) : Shell

Creates the shell.

CreateShell ( Encoding encoding, string input, Stream output, Stream extendedOutput, string terminalName, uint columns, uint rows, uint width, uint height, uint>.IDictionary terminalModes, int bufferSize ) : Shell

Creates the shell.

CreateShell ( Stream input, Stream output, Stream extendedOutput ) : Shell

Creates the shell.

CreateShell ( Stream input, Stream output, Stream extendedOutput, string terminalName, uint columns, uint rows, uint width, uint height, uint>.IDictionary terminalModes ) : Shell

Creates the shell.

CreateShell ( Stream input, Stream output, Stream extendedOutput, string terminalName, uint columns, uint rows, uint width, uint height, uint>.IDictionary terminalModes, int bufferSize ) : Shell

Creates the shell.

CreateShellStream ( string terminalName, uint columns, uint rows, uint width, uint height, int bufferSize ) : ShellStream

Creates the shell stream.

The TERM environment variable contains an identifier for the text window's capabilities. You can get a detailed list of these cababilities by using the ‘infocmp’ command.

The column/row dimensions override the pixel dimensions(when nonzero). Pixel dimensions refer to the drawable area of the window.

CreateShellStream ( string terminalName, uint columns, uint rows, uint width, uint height, int bufferSize, uint>.IDictionary terminalModeValues ) : ShellStream

Creates the shell stream.

The TERM environment variable contains an identifier for the text window's capabilities. You can get a detailed list of these cababilities by using the ‘infocmp’ command.

The column/row dimensions override the pixel dimensions(when nonzero). Pixel dimensions refer to the drawable area of the window.

RemoveForwardedPort ( ForwardedPort port ) : void

Stops and removes the forwarded port from the list.

RunCommand ( string commandText ) : SshCommand

Creates and executes the command.

This method internally uses asynchronous calls.

SshClient ( ConnectionInfo connectionInfo ) : System

Initializes a new instance of the SshClient class.

SshClient ( string host, string username ) : System

Initializes a new instance of the SshClient class.

SshClient ( string host, string username, string password ) : System

Initializes a new instance of the SshClient class.

Защищенные методы

Метод Описание
Dispose ( bool disposing ) : void

Releases unmanaged and - optionally - managed resources

OnDisconnected ( ) : void

Stops forwarded ports.

OnDisconnecting ( ) : void

Called when client is disconnecting from the server.

Приватные методы

Метод Описание
AttachForwardedPort ( ForwardedPort port ) : void
DetachForwardedPort ( ForwardedPort port ) : void
EnsureSessionIsOpen ( ) : void
SshClient ( ConnectionInfo connectionInfo, bool ownsConnectionInfo ) : System

Initializes a new instance of the SshClient class.

If ownsConnectionInfo is true, then the connection info will be disposed when this instance is disposed.

SshClient ( ConnectionInfo connectionInfo, bool ownsConnectionInfo, IServiceFactory serviceFactory ) : System

Initializes a new instance of the SshClient class.

If ownsConnectionInfo is true, then the connection info will be disposed when this instance is disposed.

SshClient ( string host, int port, string username ) : System
SshClient ( string host, int port, string username, string password ) : System

Описание методов

AddForwardedPort() публичный метод

Adds the forwarded port.
Forwarded port is already added to a different client. is null. Client is not connected.
public AddForwardedPort ( ForwardedPort port ) : void
port ForwardedPort The port.
Результат void

CreateCommand() публичный метод

Creates the command to be executed.
Client is not connected.
public CreateCommand ( string commandText ) : SshCommand
commandText string The command text.
Результат SshCommand

CreateCommand() публичный метод

Creates the command to be executed with specified encoding.
This method will change current default encoding.
Client is not connected. or is null.
public CreateCommand ( string commandText, Encoding encoding ) : SshCommand
commandText string The command text.
encoding System.Text.Encoding The encoding to use for results.
Результат SshCommand

CreateShell() публичный метод

Creates the shell.
Client is not connected.
public CreateShell ( Encoding encoding, string input, Stream output, Stream extendedOutput ) : Shell
encoding System.Text.Encoding The encoding.
input string The input.
output Stream The output.
extendedOutput Stream The extended output.
Результат Shell

CreateShell() публичный метод

Creates the shell.
Client is not connected.
public CreateShell ( Encoding encoding, string input, Stream output, Stream extendedOutput, string terminalName, uint columns, uint rows, uint width, uint height, uint>.IDictionary terminalModes ) : Shell
encoding System.Text.Encoding The encoding.
input string The input.
output Stream The output.
extendedOutput Stream The extended output.
terminalName string Name of the terminal.
columns uint The columns.
rows uint The rows.
width uint The width.
height uint The height.
terminalModes uint>.IDictionary The terminal modes.
Результат Shell

CreateShell() публичный метод

Creates the shell.
Client is not connected.
public CreateShell ( Encoding encoding, string input, Stream output, Stream extendedOutput, string terminalName, uint columns, uint rows, uint width, uint height, uint>.IDictionary terminalModes, int bufferSize ) : Shell
encoding System.Text.Encoding The encoding to use to send the input.
input string The input.
output Stream The output.
extendedOutput Stream The extended output.
terminalName string Name of the terminal.
columns uint The columns.
rows uint The rows.
width uint The width.
height uint The height.
terminalModes uint>.IDictionary The terminal mode.
bufferSize int Size of the internal read buffer.
Результат Shell

CreateShell() публичный метод

Creates the shell.
Client is not connected.
public CreateShell ( Stream input, Stream output, Stream extendedOutput ) : Shell
input Stream The input.
output Stream The output.
extendedOutput Stream The extended output.
Результат Shell

CreateShell() публичный метод

Creates the shell.
Client is not connected.
public CreateShell ( Stream input, Stream output, Stream extendedOutput, string terminalName, uint columns, uint rows, uint width, uint height, uint>.IDictionary terminalModes ) : Shell
input Stream The input.
output Stream The output.
extendedOutput Stream The extended output.
terminalName string Name of the terminal.
columns uint The columns.
rows uint The rows.
width uint The width.
height uint The height.
terminalModes uint>.IDictionary The terminal mode.
Результат Shell

CreateShell() публичный метод

Creates the shell.
Client is not connected.
public CreateShell ( Stream input, Stream output, Stream extendedOutput, string terminalName, uint columns, uint rows, uint width, uint height, uint>.IDictionary terminalModes, int bufferSize ) : Shell
input Stream The input.
output Stream The output.
extendedOutput Stream The extended output.
terminalName string Name of the terminal.
columns uint The columns.
rows uint The rows.
width uint The width.
height uint The height.
terminalModes uint>.IDictionary The terminal mode.
bufferSize int Size of the internal read buffer.
Результат Shell

CreateShellStream() публичный метод

Creates the shell stream.

The TERM environment variable contains an identifier for the text window's capabilities. You can get a detailed list of these cababilities by using the ‘infocmp’ command.

The column/row dimensions override the pixel dimensions(when nonzero). Pixel dimensions refer to the drawable area of the window.

Client is not connected.
public CreateShellStream ( string terminalName, uint columns, uint rows, uint width, uint height, int bufferSize ) : ShellStream
terminalName string The TERM environment variable.
columns uint The terminal width in columns.
rows uint The terminal width in rows.
width uint The terminal height in pixels.
height uint The terminal height in pixels.
bufferSize int Size of the buffer.
Результат ShellStream

CreateShellStream() публичный метод

Creates the shell stream.

The TERM environment variable contains an identifier for the text window's capabilities. You can get a detailed list of these cababilities by using the ‘infocmp’ command.

The column/row dimensions override the pixel dimensions(when nonzero). Pixel dimensions refer to the drawable area of the window.

Client is not connected.
public CreateShellStream ( string terminalName, uint columns, uint rows, uint width, uint height, int bufferSize, uint>.IDictionary terminalModeValues ) : ShellStream
terminalName string The TERM environment variable.
columns uint The terminal width in columns.
rows uint The terminal width in rows.
width uint The terminal height in pixels.
height uint The terminal height in pixels.
bufferSize int Size of the buffer.
terminalModeValues uint>.IDictionary The terminal mode values.
Результат ShellStream

Dispose() защищенный метод

Releases unmanaged and - optionally - managed resources
protected Dispose ( bool disposing ) : void
disposing bool true to release both managed and unmanaged resources; false to release only unmanaged resources.
Результат void

OnDisconnected() защищенный метод

Stops forwarded ports.
protected OnDisconnected ( ) : void
Результат void

OnDisconnecting() защищенный метод

Called when client is disconnecting from the server.
protected OnDisconnecting ( ) : void
Результат void

RemoveForwardedPort() публичный метод

Stops and removes the forwarded port from the list.
is null.
public RemoveForwardedPort ( ForwardedPort port ) : void
port ForwardedPort Forwarded port.
Результат void

RunCommand() публичный метод

Creates and executes the command.
This method internally uses asynchronous calls.
CommandText property is empty. Invalid Operation - An existing channel was used to execute this command. Asynchronous operation is already in progress. Client is not connected. is null.
public RunCommand ( string commandText ) : SshCommand
commandText string The command text.
Результат SshCommand

SshClient() публичный метод

Initializes a new instance of the SshClient class.
is null.
public SshClient ( ConnectionInfo connectionInfo ) : System
connectionInfo ConnectionInfo The connection info.
Результат System

SshClient() публичный метод

Initializes a new instance of the SshClient class.
is null. is invalid, -or- is null or contains only whitespace characters.
public SshClient ( string host, string username ) : System
host string Connection host.
username string Authentication username.
Результат System

SshClient() публичный метод

Initializes a new instance of the SshClient class.
is null. is invalid, or is null or contains only whitespace characters.
public SshClient ( string host, string username, string password ) : System
host string Connection host.
username string Authentication username.
password string Authentication password.
Результат System