diff options
author | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2016-10-28 23:11:53 +0200 |
---|---|---|
committer | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2016-10-30 17:46:05 +0100 |
commit | eb27e993f0f2fb3de48b7b8aa01c74cc1635a178 (patch) | |
tree | 9b56ad0b1e6dcd269df92a9ebd440698f86da0b4 /drivers/unix/ip_unix.cpp | |
parent | 2f1c8592721eca1e6a71f419208f99977ceab2d9 (diff) |
TCP/UDP Listen sockets can now be set to IPv6 only
Diffstat (limited to 'drivers/unix/ip_unix.cpp')
-rw-r--r-- | drivers/unix/ip_unix.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/unix/ip_unix.cpp b/drivers/unix/ip_unix.cpp index d6d1be3395..e3d32618ee 100644 --- a/drivers/unix/ip_unix.cpp +++ b/drivers/unix/ip_unix.cpp @@ -33,6 +33,13 @@ #include <string.h> #ifdef WINDOWS_ENABLED + // Workaround mingw missing flags! + #ifndef AI_ADDRCONFIG + #define AI_ADDRCONFIG 0x00000400 + #endif + #ifndef AI_V4MAPPED + #define AI_V4MAPPED 0x00000800 + #endif #ifdef WINRT_ENABLED #include <ws2tcpip.h> #include <winsock2.h> @@ -90,8 +97,10 @@ IP_Address IP_Unix::_resolve_hostname(const String& p_hostname, IP_Address::Addr hints.ai_family = AF_INET; } else if (p_type == IP_Address::TYPE_IPV6) { hints.ai_family = AF_INET6; + hints.ai_flags = 0; } else { hints.ai_family = AF_UNSPEC; + hints.ai_flags = (AI_V4MAPPED | AI_ADDRCONFIG); }; int s = getaddrinfo(p_hostname.utf8().get_data(), NULL, &hints, &result); |