C# Class Renci.SshNet.ShellStream

Contains operation for working with SSH Shell.
Inheritance: Stream
Show file Open project: sshnet/SSH.NET Class Usage Examples

Public Methods

Method Description
BeginExpect ( ) : IAsyncResult

Begins the expect.

BeginExpect ( AsyncCallback callback ) : IAsyncResult

Begins the expect.

BeginExpect ( AsyncCallback callback, object state ) : IAsyncResult

Begins the expect.

BeginExpect ( System.TimeSpan timeout, AsyncCallback callback, object state ) : IAsyncResult

Begins the expect.

EndExpect ( IAsyncResult asyncResult ) : string

Ends the execute.

Expect ( Regex regex ) : string

Expects the expression specified by regular expression.

Expect ( Regex regex, System.TimeSpan timeout ) : string

Expects the expression specified by regular expression.

Expect ( string text ) : string

Expects the expression specified by text.

Expect ( string text, System.TimeSpan timeout ) : string

Expects the expression specified by text.

Expect ( ) : void

Expects the specified expression and performs action when one is found.

Expect ( System.TimeSpan timeout ) : void

Expects the specified expression and performs action when one is found.

Flush ( ) : void

Clears all buffers for this stream and causes any buffered data to be written to the underlying device.

Read ( byte buffer, int offset, int count ) : int

Reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read.

Read ( ) : string

Reads text available in the shell.

ReadLine ( ) : string

Reads the line from the shell. If line is not available it will block the execution and will wait for new line.

ReadLine ( System.TimeSpan timeout ) : string

Reads a line from the shell. If line is not available it will block the execution and will wait for new line.

Seek ( long offset, SeekOrigin origin ) : long

This method is not supported.

SetLength ( long value ) : void

This method is not supported.

Write ( byte buffer, int offset, int count ) : void

Writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written.

Write ( string text ) : void

Writes the specified text to the shell.

If text is null, nothing is written.

WriteLine ( string line ) : void

Writes the line to the shell.

If line is null, only the line terminator is written.

Protected Methods

Method Description
Dispose ( bool disposing ) : void

Releases the unmanaged resources used by the T:System.IO.Stream and optionally releases the managed resources.

Private Methods

Method Description
Channel_Closed ( object sender, ChannelEventArgs e ) : void
Channel_DataReceived ( object sender, ChannelDataEventArgs e ) : void
OnDataReceived ( byte data ) : void
OnRaiseError ( ExceptionEventArgs e ) : void
Session_Disconnected ( object sender, EventArgs e ) : void
Session_ErrorOccured ( object sender, ExceptionEventArgs e ) : void
ShellStream ( ISession session, string terminalName, uint columns, uint rows, uint width, uint height, uint>.IDictionary terminalModeValues ) : System
UnsubscribeFromSessionEvents ( ISession session ) : void

Unsubscribes the current ShellStream from session events.

Does nothing when session is null.

Method Details

BeginExpect() public method

Begins the expect.
public BeginExpect ( ) : IAsyncResult
return IAsyncResult

BeginExpect() public method

Begins the expect.
public BeginExpect ( AsyncCallback callback ) : IAsyncResult
callback AsyncCallback The callback.
return IAsyncResult

BeginExpect() public method

Begins the expect.
public BeginExpect ( AsyncCallback callback, object state ) : IAsyncResult
callback AsyncCallback The callback.
state object The state.
return IAsyncResult

BeginExpect() public method

Begins the expect.
public BeginExpect ( System.TimeSpan timeout, AsyncCallback callback, object state ) : IAsyncResult
timeout System.TimeSpan The timeout.
callback AsyncCallback The callback.
state object The state.
return IAsyncResult

Dispose() protected method

Releases the unmanaged resources used by the T:System.IO.Stream and optionally releases the 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

EndExpect() public method

Ends the execute.
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.
public EndExpect ( IAsyncResult asyncResult ) : string
asyncResult IAsyncResult The async result.
return string

Expect() public method

Expects the expression specified by regular expression.
public Expect ( Regex regex ) : string
regex System.Text.RegularExpressions.Regex The regular expression to expect.
return string

Expect() public method

Expects the expression specified by regular expression.
public Expect ( Regex regex, System.TimeSpan timeout ) : string
regex System.Text.RegularExpressions.Regex The regular expression to expect.
timeout System.TimeSpan Time to wait for input.
return string

Expect() public method

Expects the expression specified by text.
public Expect ( string text ) : string
text string The text to expect.
return string

Expect() public method

Expects the expression specified by text.
public Expect ( string text, System.TimeSpan timeout ) : string
text string The text to expect.
timeout System.TimeSpan Time to wait for input.
return string

Expect() public method

Expects the specified expression and performs action when one is found.
public Expect ( ) : void
return void

Expect() public method

Expects the specified expression and performs action when one is found.
public Expect ( System.TimeSpan timeout ) : void
timeout System.TimeSpan Time to wait for input.
return void

Flush() public method

Clears all buffers for this stream and causes any buffered data to be written to the underlying device.
An I/O error occurs.
public Flush ( ) : void
return void

Read() public method

Reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read.
The sum of and is larger than the buffer length. is null. or is negative. An I/O error occurs. The stream does not support reading. Methods were called after the stream was closed.
public Read ( byte buffer, int offset, int count ) : int
buffer byte An array of bytes. When this method returns, the buffer contains the specified byte array with the values between and ( + - 1) replaced by the bytes read from the current source.
offset int The zero-based byte offset in at which to begin storing the data read from the current stream.
count int The maximum number of bytes to be read from the current stream.
return int

Read() public method

Reads text available in the shell.
public Read ( ) : string
return string

ReadLine() public method

Reads the line from the shell. If line is not available it will block the execution and will wait for new line.
public ReadLine ( ) : string
return string

ReadLine() public method

Reads a line from the shell. If line is not available it will block the execution and will wait for new line.
public ReadLine ( System.TimeSpan timeout ) : string
timeout System.TimeSpan Time to wait for input.
return string

Seek() public method

This method is not supported.
An I/O error occurs. The stream does not support seeking, such as if the stream is constructed from a pipe or console output. Methods were called after the stream was closed.
public Seek ( long offset, SeekOrigin origin ) : long
offset long A byte offset relative to the parameter.
origin SeekOrigin A value of type indicating the reference point used to obtain the new position.
return long

SetLength() public method

This method is not supported.
An I/O error occurs. The stream does not support both writing and seeking, such as if the stream is constructed from a pipe or console output. Methods were called after the stream was closed.
public SetLength ( long value ) : void
value long The desired length of the current stream in bytes.
return void

Write() public method

Writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written.
The sum of and is greater than the buffer length. is null. or is negative. An I/O error occurs. The stream does not support writing. Methods were called after the stream was closed.
public Write ( byte buffer, int offset, int count ) : void
buffer byte An array of bytes. This method copies bytes from to the current stream.
offset int The zero-based byte offset in at which to begin copying bytes to the current stream.
count int The number of bytes to be written to the current stream.
return void

Write() public method

Writes the specified text to the shell.
If text is null, nothing is written.
public Write ( string text ) : void
text string The text to be written to the shell.
return void

WriteLine() public method

Writes the line to the shell.
If line is null, only the line terminator is written.
public WriteLine ( string line ) : void
line string The line to be written to the shell.
return void