sources/network/ipaddress.cpp

changeset 81
a18aaf460648
parent 73
07dda51a7a8e
child 88
08ccaf26cffd
--- a/sources/network/ipaddress.cpp	Fri May 15 21:43:21 2015 +0300
+++ b/sources/network/ipaddress.cpp	Tue May 26 11:41:58 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