Fix getaddrinfo failing on android

(cherry picked from commit 311f1f165b)
This commit is contained in:
Fabio Alessandrelli 2016-11-30 03:01:40 +01:00
parent 1a7f14b206
commit 4635671de5
1 changed files with 5 additions and 0 deletions

View File

@ -100,7 +100,12 @@ IP_Address IP_Unix::_resolve_hostname(const String& p_hostname, IP_Address::Addr
hints.ai_flags = 0; hints.ai_flags = 0;
} else { } else {
hints.ai_family = AF_UNSPEC; 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); hints.ai_flags = (AI_V4MAPPED | AI_ADDRCONFIG);
#endif
}; };
int s = getaddrinfo(p_hostname.utf8().get_data(), NULL, &hints, &result); int s = getaddrinfo(p_hostname.utf8().get_data(), NULL, &hints, &result);