summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ev_win32.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/ev_win32.c b/ev_win32.c
index 338886e..9217af5 100644
--- a/ev_win32.c
+++ b/ev_win32.c
@@ -48,6 +48,16 @@
/* for the crt to do something about it */
volatile double SIGFPE_REQ = 0.0f;
+static SOCKET
+ev_tcp_socket (void)
+{
+#if EV_USE_WSASOCKET
+ return WSASocket (AF_INET, SOCK_STREAM, 0, 0, 0, 0);
+#else
+ return socket (AF_INET, SOCK_STREAM, 0);
+#endif
+}
+
/* oh, the humanity! */
static int
ev_pipe (int filedes [2])
@@ -59,7 +69,7 @@ ev_pipe (int filedes [2])
SOCKET listener;
SOCKET sock [2] = { -1, -1 };
- if ((listener = socket (AF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET)
+ if ((listener = ev_tcp_socket ()) == INVALID_SOCKET)
return -1;
addr.sin_family = AF_INET;
@@ -75,7 +85,7 @@ ev_pipe (int filedes [2])
if (listen (listener, 1))
goto fail;
- if ((sock [0] = socket (AF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET)
+ if ((sock [0] = ev_tcp_socket ()) == INVALID_SOCKET)
goto fail;
if (connect (sock [0], (struct sockaddr *)&addr, addr_size))