Index: src/ne_socket.c
===================================================================
--- src/ne_socket.c	(revision 1791)
+++ src/ne_socket.c	(working copy)
@@ -1178,10 +1178,11 @@
 {
     int ret;
 
-#ifdef USE_NONBLOCKING_CONNECT
+#if defined(USE_NONBLOCKING_CONNECT) || defined(WIN32)
     if (sock->cotimeout) {
         int errnum, flags;
 
+#ifdef USE_NONBLOCKING_CONNECT
         /* Get flags and then set O_NONBLOCK. */
         flags = fcntl(fd, F_GETFL);
         if (flags & O_NONBLOCK) {
@@ -1193,6 +1194,13 @@
             set_strerror(sock, errno);
             return NE_SOCK_ERROR;
         }
+#else
+        unsigned long nonblocking = 1;
+        if (ioctlsocket(fd, FIONBIO, &nonblocking)) {
+            set_strerror(sock, errnum);
+            ret = NE_SOCK_ERROR;
+        }
+#endif
         
         ret = raw_connect(fd, sa, salen);
         if (ret == -1) {
@@ -1229,12 +1237,19 @@
                 ret = NE_SOCK_ERROR;
             }
         }
-        
+#ifdef USE_NONBLOCKING_CONNECT
         /* Reset to old flags: */
         if (fcntl(fd, F_SETFL, flags) == -1) {
             set_strerror(sock, errno);
             ret = NE_SOCK_ERROR;
-        }       
+        }
+#else
+        nonblocking = 0;
+        if (ioctlsocket(fd, FIONBIO, &nonblocking)) {
+            set_strerror(sock, errnum);
+            ret = NE_SOCK_ERROR;
+        }
+#endif
     } else 
 #endif /* USE_NONBLOCKING_CONNECT */
     {
