Begins an asynchronous command execution.
Namespace: Renci.SshNetAssembly: Renci.SshNet (in Renci.SshNet.dll) Version: 0.1.0.0 (1.0.0.0)
Syntax
public IAsyncResult BeginExecute()
Return Value
AnExceptions
| Exception | Condition |
|---|---|
| Asynchronous operation is already in progress. | |
| Renci.SshNet.Common SshException | Invalid operation. |
| CommandText property is empty. | |
| Renci.SshNet.Common SshConnectionException | Client is not connected. |
| Renci.SshNet.Common SshOperationTimeoutException | Operation has timed out. |
| Asynchronous operation is already in progress. | |
| CommandText property is empty. |
Examples
client.Connect(); var cmd = client.CreateCommand("sleep 15s;echo 123"); // Perform long running task var asynch = cmd.BeginExecute(); while (!asynch.IsCompleted) { // Waiting for command to complete... Thread.Sleep(2000); } result = cmd.EndExecute(asynch); client.Disconnect();
See Also