Dns.GetHostAddresses() only returns IPv6 addresses . How to get Local IPv4?
问题 According to Dotnet reference , Dns.GetHostAddresses("") should return IPv4 addresses . However I am getting only IPv6 on my windows 7 machine. I tried the program on a different windows 7 still the same result. It only returned IPv4 correctly on an XP machine. If I try , Dns.GetHostEntry(""); It now correctly returns one IPv4 and one IPv6 . How do I get IPv4 from GetHostAddresses() because I don't want to use GetHostEntry(). It looks up the DNS. Also, say for a computer with 1 Network card,