]> git.mxchange.org Git - simgear.git/commitdiff
Request only IP4 addresses for the moment, further work required to deal with IP6...
authorJames Turner <zakalawe@mac.com>
Fri, 26 Aug 2011 08:36:59 +0000 (09:36 +0100)
committerJames Turner <zakalawe@mac.com>
Fri, 26 Aug 2011 08:36:59 +0000 (09:36 +0100)
simgear/io/raw_socket.cxx

index aaa7d871fb0722f52d3c451223d2d119fa93a5cf..c07165809f8002f2241ef30c14377db05ff0cc2e 100644 (file)
@@ -115,12 +115,18 @@ void IPAddress::set ( const char* host, int port )
     return;
   }
   
+  struct addrinfo hints;
+  memset(&hints, 0, sizeof(struct addrinfo));
+  hints.ai_family = AF_INET;
+  
   struct addrinfo* result = NULL;
   int err = getaddrinfo(host, NULL, NULL /* no hints */, &result);
   if (err) {
     SG_LOG(SG_IO, SG_WARN, "getaddrinfo failed for '" << host << "' : " << gai_strerror(err));
   } else if (result->ai_addrlen != getAddrLen()) {
-    SG_LOG(SG_IO, SG_ALERT, "mismatch in socket address sizes");
+    SG_LOG(SG_IO, SG_ALERT, "mismatch in socket address sizes: got " <<
+        result->ai_addrlen << ", expected " << getAddrLen());
+    SG_LOG(SG_IO, SG_ALERT, "family:" << result->ai_family);
   } else {
     memcpy(addr, result->ai_addr, result->ai_addrlen);
   }