Waits for the pending asynchronous command execution to complete.
Namespace: Renci.SshNetAssembly: Renci.SshNet (in Renci.SshNet.dll) Version: 0.1.0.0 (1.0.0.0)
Syntax
public string EndExecute( IAsyncResult asyncResult )
Parameters
- asyncResult
- Type:
System IAsyncResult
The reference to the pending asynchronous request to finish.
Return Value
Command execution result.Exceptions
| Exception | Condition |
|---|---|
| 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. | |
| 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. |
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