From e9f87f952065e07ae9076df1f3696f7bd8819efc Mon Sep 17 00:00:00 2001
From: deuce <>
Date: Sun, 1 Sep 2013 05:44:50 +0000
Subject: [PATCH] Attempt to fix for windows.  We don't currently include
 ws2tcpip.h which is what defines socklen_t, so we need to undefine our copy
 before including that header.

---
 src/xpdev/multisock.c | 11 +++++++++++
 src/xpdev/sockwrap.c  |  2 ++
 2 files changed, 13 insertions(+)

diff --git a/src/xpdev/multisock.c b/src/xpdev/multisock.c
index 0fae431306..3b1dd9f47c 100644
--- a/src/xpdev/multisock.c
+++ b/src/xpdev/multisock.c
@@ -7,6 +7,17 @@
 #include <sockwrap.h>
 #include <multisock.h>
 
+#ifdef _WIN32
+#undef socklen_t
+#include <ws2tcpip.h>
+# ifndef AI_ADDRCONFIG
+#  define AI_ADDRCONFIG 0x400 // Vista or later
+# endif
+# ifndef AI_NUMERICSERV
+#  define AI_NUMERICSERV 0		// Not supported by Win32
+# endif
+#endif
+
 struct xpms_set *xpms_create(unsigned int retries, unsigned int wait_secs,
 	int (*lprintf)(int level, const char *fmt, ...))
 {
diff --git a/src/xpdev/sockwrap.c b/src/xpdev/sockwrap.c
index c386fb0e91..7f453266d2 100644
--- a/src/xpdev/sockwrap.c
+++ b/src/xpdev/sockwrap.c
@@ -42,6 +42,8 @@
 #include <stdio.h>		/* SEEK_SET */
 #include <string.h>
 #if defined(_WIN32)
+ #undef socklen_t
+ #include <ws2tcpip.h>
  #include <malloc.h>	/* alloca() on Win32 */
 #endif
 
-- 
GitLab