- Home /
Question by
Pr0n · Jul 22, 2015 at 03:35 PM ·
iosnetworkingxcodeunity multiplayer
[UNet] "No such host is known" error on iOS
Hello, I just done my new app and its working on UnityEditor, but now I create Xcode project (v6.4) and I got error:
2015-07-22 17:24:26.554 ComradeWars[414:45370] -> registered mono modules 0x1014058a0
-> applicationDidFinishLaunching()
PlayerConnection initialized from /private/var/mobile/Containers/Bundle/Application/5FDB6136-231C-45F5-BC0A-7A6BCBB12D96/ComradeWars.app/Data (debug = 0)
PlayerConnection initialized network socket : 0.0.0.0 55000
Multi-casting "[IP] 192.168.0.103 [Port] 55000 [Flags] 3 [Guid] 1192420317 [EditorId] 342940737 [Version] 1048832 [Id] iPhonePlayer(iPad):56000 [Debug] 1" to [225.0.0.222:54997]...
Waiting for connection from host on [192.168.0.103:55000]...
PlayerConnection accepted from [192.168.0.101] handle:0x8
-> applicationDidBecomeActive()
Requesting Resolution: 2048x1536
Init: screen size 2048x1536
Initializing Metal device caps
Initialize engine version: 5.1.1p4 (c439df19cd24)
SocketException: No such host is known // <- HERE
at System.Collections.Specialized.ListDictionary+DictionaryNodeEnumerator.MoveNext () [0x00000] in <filename unknown>:0
at System.Net.Dns.GetHostByName (System.String hostName) [0x00000] in <filename unknown>:0
at System.Net.Dns.GetHostEntry (System.String hostNameOrAddress) [0x00000] in <filename unknown>:0
at ComradNetManager.LocalIpAddress () [0x00000] in <filename unknown>:0
at ComradNetManager.ConfigNetwork () [0x00000] in <filename unknown>:0
at ComradNetManager.Start () [0x00000] in <filename unknown>:0
I tried debug it.. In UnityEditor everything is going alright. Init called etc. But on iOS it crashs here:
public string LocalIpAddress()
{
IPHostEntry host;
string localIP = "";
host = Dns.GetHostEntry(Dns.GetHostName());
foreach (IPAddress ip in host.AddressList)
{
if (ip.AddressFamily == AddressFamily.InterNetwork)
{
localIP = ip.ToString();
break;
}
}
logger.text += "\nLocalIpAddress called and IP is: " + localIP;
return localIP;
}
Any one know, how to fix it?
Comment
Best Answer
Answer by Pr0n · Jul 23, 2015 at 03:38 AM
I already solved this problem with replace LocalIpAddress method with:
Network.player.ipAddress
So the problem was in System.Net and iOS compilation.