From 4635671de5daf5e6b9f58372e0580ec5e19fd023 Mon Sep 17 00:00:00 2001 From: Fabio Alessandrelli Date: Wed, 30 Nov 2016 03:01:40 +0100 Subject: [PATCH] Fix getaddrinfo failing on android (cherry picked from commit 311f1f165be12ea290799e42f9951011d997ab40) --- drivers/unix/ip_unix.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/unix/ip_unix.cpp b/drivers/unix/ip_unix.cpp index e3d32618eec..f74e577f9a3 100644 --- a/drivers/unix/ip_unix.cpp +++ b/drivers/unix/ip_unix.cpp @@ -100,7 +100,12 @@ IP_Address IP_Unix::_resolve_hostname(const String& p_hostname, IP_Address::Addr hints.ai_flags = 0; } else { hints.ai_family = AF_UNSPEC; +#ifdef ANDROID_ENABLED + // AI_V4MAPPED is not supported by android getaadrinfo + hints.ai_flags = AI_ADDRCONFIG; +#else hints.ai_flags = (AI_V4MAPPED | AI_ADDRCONFIG); +#endif }; int s = getaddrinfo(p_hostname.utf8().get_data(), NULL, &hints, &result);