David Van Dorsten
David Van Dorsten

Reputation: 36

AirConsole Unity package error on MacOS: SocketException No such host is known

Disclaimer: I know almost nothing about Unity\C# networking

The script located in the Unity air console package at Airconsole/scripts/editor/Extensions.cs contains the method GetLocalAddress().

This method results in a runtime error on my Mac (MacOS 10.12.1, Unity 5.5.0f3), but not on a friend's Windows machine (Win10, Unity 5.5.0f3).

The error is: SocketException: No such host is known, System.Net.Dns.GetHostByName (System.String hostName)

The line causing the error is:

foreach (IPAddress ip in Dns.GetHostEntry(Dns.GetHostName()).AddressList) {

Dns.GetHostName() returns my computer name : "MacMini", but passing it as an argument to Dns.GetHostEntry() results in the error.

To work around this while developing, I have replaced the code contained in the GetLocalAddress() method with a single line:

return UnityEngine.Network.player.ipAddress.ToString();

and the Unity project runs with the virtual controllers working correctly in my browser.

Any ideas as to what would cause this problem?

Upvotes: 0

Views: 345

Answers (1)

jammy2232
jammy2232

Reputation: 21

Disclaimer - I am not too confident that this will help but I was having the same problem.

It turned out that it would't work in the uni network and when I used my phone as a hot spot it worked no problem.

I think the issue lies with getting the local ip from the uni network. We ended up solving this by setting up our own local network which was connected to the net via a laptop using the same uni network. It connects fine however we are suffering some really bad lag currently.

I hope this is some sort of help.

Upvotes: 1

Related Questions