简体   繁体   中英

Why does a call to IPInterfaceProperties::DnsAddresses return three DNS servers?

I have some code running on a Windows XP Embedded machine which attempts to record the current network settings using a snippet along the following lines:

array<NetworkInterface^>^ ifs = NetworkInterface::GetAllNetworkInterfaces();
for each (NetworkInterface^ nic in ifs)
{
    IPInterfaceProperties^ properties = nic->GetIPProperties();
    for each( IPAddress^ ipaddress in properties->DnsAddresses)
    {
        Console::WriteLine(String::Format("{0}", ipaddress));
    }
}

The machine has two static DNS servers set (8.8.8.8 and 8.8.8.4) so why does the code above print out:

fec0:0:0:ffff::1%1
8.8.8.8
8.8.4.4

Where does that first line come from? ..and why doesn't it appear if I run the same code on a Windows 7 machine?

Looks like a default IPv6 DNS address. I'm not sure why it wouldn't show up in Windows 7 but I guess it depends on your DNS settings.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM