Index: build-tree/ocaml-3.12.1/otherlibs/win32unix/nonblock.c
===================================================================
--- build-tree.orig/ocaml-3.12.1/otherlibs/win32unix/nonblock.c	2010-05-25 15:01:06.000000000 +0200
+++ build-tree/ocaml-3.12.1/otherlibs/win32unix/nonblock.c	2011-10-09 04:37:08.311934494 +0200
@@ -26,7 +26,7 @@
     win32_maperr(WSAGetLastError());
     uerror("unix_set_nonblock", Nothing);
   }
-  Flags_fd_val(socket) = Flags_fd_val(socket) | FLAGS_FD_IS_BLOCKING;
+  Flags_fd_val(socket) = Flags_fd_val(socket) & ~FLAGS_FD_IS_BLOCKING;
   return Val_unit;
 }
 
@@ -39,6 +39,6 @@
     win32_maperr(WSAGetLastError());
     uerror("unix_clear_nonblock", Nothing);
   }
-  Flags_fd_val(socket) = Flags_fd_val(socket) & ~FLAGS_FD_IS_BLOCKING;
+  Flags_fd_val(socket) = Flags_fd_val(socket) | FLAGS_FD_IS_BLOCKING;
   return Val_unit;
 }
Index: build-tree/ocaml-3.12.1/otherlibs/win32unix/select.c
===================================================================
--- build-tree.orig/ocaml-3.12.1/otherlibs/win32unix/select.c	2010-05-25 15:01:06.000000000 +0200
+++ build-tree/ocaml-3.12.1/otherlibs/win32unix/select.c	2011-10-09 04:37:08.311934494 +0200
@@ -556,7 +556,7 @@
       if (iterQuery->uFlagsFd & FLAGS_FD_IS_BLOCKING)
       {
         DEBUG_PRINT("Restore a blocking socket");
-        iMode = 1;
+        iMode = 0;
         check_error(lpSelectData,
           WSAEventSelect((SOCKET)(iterQuery->hFileDescr), aEvents[i], 0) != 0 ||
           ioctlsocket((SOCKET)(iterQuery->hFileDescr), FIONBIO, &iMode) != 0);
Index: build-tree/ocaml-3.12.1/otherlibs/win32unix/unixsupport.c
===================================================================
--- build-tree.orig/ocaml-3.12.1/otherlibs/win32unix/unixsupport.c	2010-05-25 15:01:06.000000000 +0200
+++ build-tree/ocaml-3.12.1/otherlibs/win32unix/unixsupport.c	2011-10-09 04:37:08.311934494 +0200
@@ -53,7 +53,7 @@
   Handle_val(res) = h;
   Descr_kind_val(res) = KIND_HANDLE;
   CRT_fd_val(res) = NO_CRT_FD;
-  Flags_fd_val(res) = 0;
+  Flags_fd_val(res) = FLAGS_FD_IS_BLOCKING;
   return res;
 }
 
@@ -63,7 +63,7 @@
   Socket_val(res) = s;
   Descr_kind_val(res) = KIND_SOCKET;
   CRT_fd_val(res) = NO_CRT_FD;
-  Flags_fd_val(res) = 0;
+  Flags_fd_val(res) = FLAGS_FD_IS_BLOCKING;
   return res;
 }
 
