- Home /
Calling System.Net.Dns.GetHostEntry(sHostName) failed
Hi all, This should not be a new problem, but I couldn't find any answers on the internet, here's the detail:
I use:
string sHostName = System.Net.Dns.GetHostName();
to get the host name and pass it to the following code:(the hostname is 'bogon')
System.Net.IPHostEntry hostEntry = System.Net.Dns.GetHostEntry(sHostName);
but I got an exception: "System.Net.Sockets.SocketException: No such host is known..... balabala..."
my dev environment is mac Unity editor 5.5.1f1, hope anyone can help me, Thanks!
I can't reproduce the problem here on my windows machine. I ran your code 1:1 and it tells me my computer network name as well as all IPAddresses asociated with my PC. (which are 10 btw. 7x IPv6 and 3x IPv4). Of course the IPv4 addresses are only private addresses since i'm (as most people are) located behind a NAPT router.
it might be only occurred on $$anonymous$$ac environment... I can't reproduce this problem on Windows either.
Your answer
Follow this Question
Related Questions
Networking ? 2 Answers
When Networking do you need to use your IP address? 0 Answers
I need an alternative to Network.player.ipAdress 0 Answers
Using Unity Behind proxy 1 Answer
Connect to server over web 1 Answer