summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/pure/net.nim3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/pure/net.nim b/lib/pure/net.nim
index af9eea51a..2d1ca8a59 100644
--- a/lib/pure/net.nim
+++ b/lib/pure/net.nim
@@ -1664,6 +1664,9 @@ proc connect*(socket: Socket, address: string, port = Port(0),
   if selectWrite(s, timeout) != 1:
     raise newException(TimeoutError, "Call to 'connect' timed out.")
   else:
+    let res = getSockOptInt(socket.fd, SOL_SOCKET, SO_ERROR)
+    if res != 0:
+      raiseOSError(OSErrorCode(res))
     when defineSsl and not defined(nimdoc):
       if socket.isSSL:
         socket.fd.setBlocking(true)