summaryrefslogtreecommitdiffhomepage
path: root/src/os/win32
diff options
context:
space:
mode:
Diffstat (limited to 'src/os/win32')
-rw-r--r--src/os/win32/ngx_socket.c22
-rw-r--r--src/os/win32/ngx_socket.h16
2 files changed, 38 insertions, 0 deletions
diff --git a/src/os/win32/ngx_socket.c b/src/os/win32/ngx_socket.c
new file mode 100644
index 000000000..590eb08e7
--- /dev/null
+++ b/src/os/win32/ngx_socket.c
@@ -0,0 +1,22 @@
+#include <nxg_config.h>
+
+#include <nxg_log.h>
+#include <nxg_errno.h>
+#include <nxg_socket.h>
+
+
+void ngx_init_sockets(ngx_log_t *log)
+{
+ WSADATA wsd;
+
+ if (WSAStartup(MAKEWORD(2,2), &wsd) != 0)
+ ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno,
+ "ngx_init_sockets: WSAStartup failed");
+}
+
+int ngx_nonblocking(ngx_socket_t s)
+{
+ unsigned long nb = 1;
+
+ return ioctlsocket(s, FIONBIO, &nb);
+}
diff --git a/src/os/win32/ngx_socket.h b/src/os/win32/ngx_socket.h
new file mode 100644
index 000000000..36ed26f69
--- /dev/null
+++ b/src/os/win32/ngx_socket.h
@@ -0,0 +1,16 @@
+#ifndef _NGX_SOCKET_H_INCLUDED_
+#define _NGX_SOCKET_H_INCLUDED_
+
+
+#include <ngx_config.h>
+
+typedef SOCKET ngx_socket_t;
+
+void ngx_init_sockets(ngx_log_t *log);
+
+int ngx_nonblocking_n(s);
+#define ngx_nonblocking_n "ioctlsocket (FIONBIO)"
+
+
+
+#endif /* _NGX_SOCKET_H_INCLUDED_ */