mirror of
https://github.com/sshnet/SSH.NET.git
synced 2026-10-28 22:49:59 +08:00
Throw an exception if connection could not be established
This commit is contained in:
@@ -42,7 +42,10 @@ namespace Renci.SshNet
|
||||
// Connect socket with specified timeout
|
||||
var connectResult = this._socket.BeginConnect(ep, null, null);
|
||||
|
||||
connectResult.AsyncWaitHandle.WaitOne(this.ConnectionInfo.Timeout, false);
|
||||
if (!connectResult.AsyncWaitHandle.WaitOne(this.ConnectionInfo.Timeout, false))
|
||||
{
|
||||
throw new SshOperationTimeoutException("Connection Could Not Be Established");
|
||||
}
|
||||
|
||||
this._socket.EndConnect(connectResult);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user