i’ve been searching online about the Dns gethostbyname change to gethostentry, and modify the code accordingly, but why still not display the normal ipv4 address?
here my code:
string GetHostIP()
{
String myHostName = System.Net.Dns.GetHostName();
// Find host by name
System.Net.IPHostEntry myiphost = System.Net.Dns.GetHostEntry(myHostName);
String ipstring = "";
foreach(System.Net.IPAddress myipadd in myiphost.AddressList)
{
ipstring = myipadd.ToString();
return ipstring;
}
return ipstring;
}
They are trying to make you stop assuming the IP address is a dotted-decimal IPv4 address. They just can’t get IPv6 off the ground and that’s necessary. Completely out of free addresses as of a couple of months ago.
You can get the IPv4 address, you’ll have to fish it out explicitly: