C# Class Renci.SshNet.SshCommand

Represents SSH command that can be executed.
Inheritance: IDisposable
Datei anzeigen Open project: sshnet/SSH.NET Class Usage Examples

Public Methods

Method Description
BeginExecute ( ) : IAsyncResult

Begins an asynchronous command execution.

BeginExecute ( AsyncCallback callback ) : IAsyncResult

Begins an asynchronous command execution.

BeginExecute ( AsyncCallback callback, object state ) : IAsyncResult

Begins an asynchronous command execution.

BeginExecute ( string commandText, AsyncCallback callback, object state ) : IAsyncResult

Begins an asynchronous command execution.

CancelAsync ( ) : void

Cancels command execution in asynchronous scenarios.

Dispose ( ) : void

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

EndExecute ( IAsyncResult asyncResult ) : string

Waits for the pending asynchronous command execution to complete.

Execute ( ) : string

Executes command specified by CommandText property.

Execute ( string commandText ) : string

Executes the specified command text.

Protected Methods

Method Description
Dispose ( bool disposing ) : void

Releases unmanaged and - optionally - managed resources

Private Methods

Method Description
Channel_Closed ( object sender, ChannelEventArgs e ) : void
Channel_DataReceived ( object sender, ChannelDataEventArgs e ) : void
Channel_ExtendedDataReceived ( object sender, ChannelExtendedDataEventArgs e ) : void
Channel_RequestReceived ( object sender, ChannelRequestEventArgs e ) : void
CreateChannel ( ) : IChannelSession
Session_Disconnected ( object sender, EventArgs e ) : void
Session_ErrorOccured ( object sender, ExceptionEventArgs e ) : void
SshCommand ( ISession session, string commandText, Encoding encoding ) : System

Initializes a new instance of the SshCommand class.

UnsubscribeFromEventsAndDisposeChannel ( IChannel channel ) : void

Unsubscribes the current SshCommand from channel events, and disposes the IChannel.

Does nothing when channel is null.

WaitOnHandle ( WaitHandle waitHandle ) : void The actual command will be included in the exception message.

Method Details

BeginExecute() public method

Begins an asynchronous command execution.
Asynchronous operation is already in progress. Invalid operation. CommandText property is empty. Client is not connected. Operation has timed out. Asynchronous operation is already in progress. CommandText property is empty.
public BeginExecute ( ) : IAsyncResult
return IAsyncResult

BeginExecute() public method

Begins an asynchronous command execution.
Asynchronous operation is already in progress. Invalid operation. CommandText property is empty. Client is not connected. Operation has timed out. Asynchronous operation is already in progress. CommandText property is empty.
public BeginExecute ( AsyncCallback callback ) : IAsyncResult
callback AsyncCallback An optional asynchronous callback, to be called when the command execution is complete.
return IAsyncResult

BeginExecute() public method

Begins an asynchronous command execution.
Asynchronous operation is already in progress. Invalid operation. CommandText property is empty. Client is not connected. Operation has timed out. Asynchronous operation is already in progress. CommandText property is empty.
public BeginExecute ( AsyncCallback callback, object state ) : IAsyncResult
callback AsyncCallback An optional asynchronous callback, to be called when the command execution is complete.
state object A user-provided object that distinguishes this particular asynchronous read request from other requests.
return IAsyncResult

BeginExecute() public method

Begins an asynchronous command execution.
Client is not connected. Operation has timed out.
public BeginExecute ( string commandText, AsyncCallback callback, object state ) : IAsyncResult
commandText string The command text.
callback AsyncCallback An optional asynchronous callback, to be called when the command execution is complete.
state object A user-provided object that distinguishes this particular asynchronous read request from other requests.
return IAsyncResult

CancelAsync() public method

Cancels command execution in asynchronous scenarios.
public CancelAsync ( ) : void
return void

Dispose() public method

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public Dispose ( ) : void
return void

Dispose() protected method

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.
return void

EndExecute() public method

Waits for the pending asynchronous command execution to complete.
Either the IAsyncResult object did not come from the corresponding async method on this type, or EndExecute was called multiple times with the same IAsyncResult. is null.
public EndExecute ( IAsyncResult asyncResult ) : string
asyncResult IAsyncResult The reference to the pending asynchronous request to finish.
return string

Execute() public method

Executes command specified by CommandText property.
Client is not connected. Operation has timed out.
public Execute ( ) : string
return string

Execute() public method

Executes the specified command text.
Client is not connected. Operation has timed out.
public Execute ( string commandText ) : string
commandText string The command text.
return string