From 2f9ba31b0ad0a18f240f5ab8bed2a59ef6209287 Mon Sep 17 00:00:00 2001 From: James Turner Date: Fri, 26 Aug 2011 09:36:59 +0100 Subject: [PATCH] Request only IP4 addresses for the moment, further work required to deal with IP6 addresses. --- simgear/io/raw_socket.cxx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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); } -- 2.39.5