<PackageReference Include="SSH.NET" Version="2024.1.0" />

ShellStream

public class ShellStream : Stream
Contains operation for working with SSH Shell.
public bool DataAvailable { get; }

Gets a value indicating whether data is available on the ShellStream to be read.

Occurs when the channel was closed.

Occurs when data was received.

Occurs when an error occurred.

public IAsyncResult BeginExpect(ExpectAction[] expectActions)

Begins the expect.

public IAsyncResult BeginExpect(AsyncCallback callback, ExpectAction[] expectActions)

Begins the expect.

public IAsyncResult BeginExpect(AsyncCallback callback, object state, ExpectAction[] expectActions)

Begins the expect.

public IAsyncResult BeginExpect(TimeSpan timeout, AsyncCallback callback, object state, ExpectAction[] expectActions)

Begins the expect.

public IAsyncResult BeginExpect(TimeSpan timeout, int lookback, AsyncCallback callback, object state, ExpectAction[] expectActions)

Begins the expect.

public string EndExpect(IAsyncResult asyncResult)

Ends the execute.

public void Expect(ExpectAction[] expectActions)

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

public void Expect(TimeSpan timeout, ExpectAction[] expectActions)

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

public void Expect(TimeSpan timeout, int lookback, ExpectAction[] expectActions)

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

public string Expect(string text)

Expects the expression specified by text.

public string Expect(string text, TimeSpan timeout, int lookback = -1)

Expects the expression specified by text.

public string Expect(Regex regex)

Expects the expression specified by regular expression.

public string Expect(Regex regex, TimeSpan timeout, int lookback = -1)

Expects the expression specified by regular expression.

public string Read()

Reads all of the text currently available in the shell.

public string ReadLine()

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

public string ReadLine(TimeSpan timeout)

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

public void Write(string text)

Writes the specified text to the shell.

public void WriteLine(string line)

Writes the line to the shell.