sources/network/ipaddress.cpp

branch
protocol5
changeset 84
3bd32eec3d57
parent 81
a18aaf460648
child 88
08ccaf26cffd
--- a/sources/network/ipaddress.cpp	Sun May 17 22:07:48 2015 +0300
+++ b/sources/network/ipaddress.cpp	Wed May 27 21:15:52 2015 +0300
@@ -28,13 +28,26 @@
 	SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
+#include "ipaddress.h"
+
+#ifndef _WIN32
+# include <netinet/in.h>
+# include <netdb.h>
+#else
+# include <winsock2.h>
+# include <ws2tcpip.h>
+#endif
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <time.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#include "ipaddress.h"
+
+#ifdef _WIN32
+using AddrInfo = ADDRINFOA;
+#else
+using AddrInfo = struct addrinfo;
+#endif
 
 // -----------------------------------------------------------------------------
 //
@@ -168,8 +181,8 @@
 STATIC METHOD
 IPAddress::resolve (String node) -> IPAddress
 {
-	addrinfo hints;
-	addrinfo* lookup;
+	AddrInfo hints;
+	AddrInfo* lookup;
 	memset (&hints, 0, sizeof hints);
 	hints.ai_family = AF_INET;
 

mercurial