From: James Turner Date: Fri, 26 Aug 2011 08:36:59 +0000 (+0100) Subject: Request only IP4 addresses for the moment, further work required to deal with IP6... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=2f9ba31b0ad0a18f240f5ab8bed2a59ef6209287;p=simgear.git Request only IP4 addresses for the moment, further work required to deal with IP6 addresses. --- diff --git a/simgear/io/raw_socket.cxx b/simgear/io/raw_socket.cxx index aaa7d871..c0716580 100644 --- a/simgear/io/raw_socket.cxx +++ b/simgear/io/raw_socket.cxx @@ -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); }