diff --git a/Renci.SshClient/Renci.SshNet/Session.NET.cs b/Renci.SshClient/Renci.SshNet/Session.NET.cs index a18b50a3..fb95f21d 100644 --- a/Renci.SshClient/Renci.SshNet/Session.NET.cs +++ b/Renci.SshClient/Renci.SshNet/Session.NET.cs @@ -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); }