Network issue on iOS

From ETC Public Wiki
Jump to: navigation, search

IP Address

If you are using .NET network connection instead of Unity network, you'll find using Dns.GetHostAddresses(Dns.GetHostName())[0] does not work on iOS.
An easy fix will be using IPAddress.Parse(UnityEngine.Network.player.ipAddress) instead.
If you are developing cross-platform framework, or don't want your framework relied on Unity, it is recommended to use UNITY_IPHONE platform defines to separate the code.

UDP vs 3G

Basically 3G network does not allow UDP data transaction. This should be the same for both iOS and Android (NOT tested).
It is recommended to use WIFI if you need UDP connection.
TCP connection is proved to be working with 3G on iOS by Project Locomobio.