diff options
| author | George Marques | 2016-09-03 19:36:44 -0300 |
|---|---|---|
| committer | George Marques | 2017-06-07 11:36:00 -0300 |
| commit | c51f54749f88cb7cce3a5b653f0df2cad1f64fe8 (patch) | |
| tree | 29e36ba0c282ba792942b9b874ad842fd191217c /drivers/unix/ip_unix.cpp | |
| parent | 1d759f02e6c34ad68f737fe024c6f996d5e3ffe7 (diff) | |
| download | godot-c51f54749f88cb7cce3a5b653f0df2cad1f64fe8.tar.gz godot-c51f54749f88cb7cce3a5b653f0df2cad1f64fe8.tar.zst godot-c51f54749f88cb7cce3a5b653f0df2cad1f64fe8.zip | |
Diffstat (limited to 'drivers/unix/ip_unix.cpp')
| -rw-r--r-- | drivers/unix/ip_unix.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/unix/ip_unix.cpp b/drivers/unix/ip_unix.cpp index 8d46495e1..feb1809fc 100644 --- a/drivers/unix/ip_unix.cpp +++ b/drivers/unix/ip_unix.cpp @@ -127,6 +127,15 @@ void IP_Unix::get_local_addresses(List<IP_Address> *r_addresses) const { using namespace Windows::Networking; using namespace Windows::Networking::Connectivity; + auto hostnames = NetworkInformation::GetHostNames(); + + for (int i = 0; i < hostnames->Size; i++) { + + if (hostnames->GetAt(i)->Type == HostNameType::Ipv4 && hostnames->GetAt(i)->IPInformation != nullptr) { + + r_addresses->push_back(IP_Address(String(hostnames->GetAt(i)->CanonicalName->Data()))); + } + } auto hostnames = NetworkInformation::GetHostNames(); @@ -148,10 +157,7 @@ void IP_Unix::get_local_addresses(List<IP_Address> *r_addresses) const { while (true) { addrs = (IP_ADAPTER_ADDRESSES *)memalloc(buf_size); - int err = GetAdaptersAddresses(AF_UNSPEC, GAA_FLAG_SKIP_ANYCAST | - GAA_FLAG_SKIP_MULTICAST | - GAA_FLAG_SKIP_DNS_SERVER | - GAA_FLAG_SKIP_FRIENDLY_NAME, + int err = GetAdaptersAddresses(AF_UNSPEC, GAA_FLAG_SKIP_ANYCAST | GAA_FLAG_SKIP_MULTICAST | GAA_FLAG_SKIP_DNS_SERVER | GAA_FLAG_SKIP_FRIENDLY_NAME, NULL, addrs, &buf_size); if (err == NO_ERROR) { break; |
