Tasharen Entertainment Forum

Support => TNet 3 Support => Topic started by: ReapeR13 on May 14, 2013, 05:45:46 PM

Title: iOS Errors
Post by: ReapeR13 on May 14, 2013, 05:45:46 PM
 Hi, I am getting some weird errors on iOS Pro using Unity 4.1.2 and the latest Tnet version.

 A " Non matching Profiler.EndSample (BeginSample and EndSample count must match) " followed by " Operation timed out ". This happens when I try to start a server in the Tnet "Example Menu" scene.



Title: Re: iOS Errors
Post by: ArenMook on May 15, 2013, 01:25:28 AM
I've never seen that one, and Starlink is using TNet on iOS without issues, also built with 4.1.2. Try restarting Unity, and if that doesn't help, you might have to debug some more as to what's causing it to happen on your end.
Title: Re: iOS Errors
Post by: ReapeR13 on May 15, 2013, 04:11:39 AM
 I made a fresh new project and only imported Tnet directly from the Asset Store, restarted Unity, restarted the computer, opening only the "Example Menu" scene and each time I get the same error.

 If I try to disable my Wi-Fi connection and I get an additional:

Quote
SocketException: No route to host
System.Net.Sockets.Socket.SendTo_nochecks (System.Byte[] buffer, Int32 offset, Int32 size, SocketFlags flags, System.Net.EndPoint remote_end)
System.Net.Sockets.Socket.SendTo (System.Byte[] buffer, Int32 offset, Int32 size, SocketFlags flags, System.Net.EndPoint remote_end)
TNet.UdpProtocol.Broadcast (TNet.Buffer buffer, Int32 port) (at Assets/TNet/Common/TNUdpProtocol.cs:211)
TNet.UdpProtocol.Send (TNet.Buffer buffer, System.Net.IPEndPoint ip) (at Assets/TNet/Common/TNUdpProtocol.cs:225)
TNUdpLobbyClient.Update () (at Assets/TNet/Client/TNUdpLobbyClient.cs:132)

 And instead of the " Operation timed out " warning I get " No route to host " warning, the previous " Non matching Profiler.EndSample (BeginSample and EndSample count must match) " still happens every time.

 Am I missing some project settings or something?

 EDIT: Actually when my Wi-Fi is off I get both errors re-triggered every second or so.
Title: Re: iOS Errors
Post by: ReapeR13 on May 15, 2013, 04:39:10 AM
 I also tested on PC, here I don't get any errors, even if the Wi-Fi is dissabled, but I do get a " A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. " every time after I start the server.
Title: Re: iOS Errors
Post by: ArenMook on May 15, 2013, 09:47:01 AM
No route to host I can understand if wifi is disabled. Profiler messages, however? Profiler is something that's there in the editor, not on the device. Or are you trying to profile the iOS device?

Operation timed out is likely related to the fact that the device can't reach a UPnP-capable router.
Title: Re: iOS Errors
Post by: ReapeR13 on May 15, 2013, 10:30:07 AM
 I have no idea why it gives me that profiler error, I'm testing in the editor with nothing special going on with the profiler. It throws that error when this is accessed: " TNServerInstance.Start(serverTcpPort, udpPort, "server.dat", lobbyPort); "

 If I start the server with a NGUI button like this:
Quote
buttonLocalStartServer.onButtonClick += delegate(object sender, System.EventArgs ea)
        {

        #if UNITY_WEBPLAYER
                    labelMessages.text = "Can't host from the Web Player due to Unity's security restrictions";
        #else
            int udpPort = Random.Range(10000, 40000);

            // Start a local server, loading the saved data if possible
            // The UDP port of the server doesn't matter much as it's optional,
            // and the clients get notified of it via Packet.ResponseSetUDP.

            TNUdpLobbyClient lan = FindObjectOfType(typeof(TNUdpLobbyClient)) as TNUdpLobbyClient;

            int lobbyPort = lan.remotePort;
            TNServerInstance.Start(serverTcpPort, udpPort, "server.dat", lobbyPort);

        #endif
        };

 I get this error:

Quote
Non matching Profiler.EndSample (BeginSample and EndSample count must match)
UnityEngine.GameObject:SendMessage(String, Object, SendMessageOptions)
UICamera:Notify(GameObject, String, Object) (at Assets/Plugins/NGUI/UI/UICamera.cs:647)
UICamera:ProcessTouch(Boolean, Boolean) (at Assets/Plugins/NGUI/UI/UICamera.cs:1155)
UICamera:ProcessMouse() (at Assets/Plugins/NGUI/UI/UICamera.cs:909)
UICamera:Update() (at Assets/Plugins/NGUI/UI/UICamera.cs:764)

 I will test on the devices later on today.
Title: Re: iOS Errors
Post by: ReapeR13 on May 15, 2013, 11:32:48 AM
 I don't get the profiler errors on the devices but I do get the "No route to host" error when I am not connected to the Wi-Fi. Will this be fixed in the next update?
Title: Re: iOS Errors
Post by: ArenMook on May 15, 2013, 12:21:31 PM
I can add a check for it, sure. However you should really be checking Application.internetReachability before trying to use the internet functionality.
Title: Re: iOS Errors
Post by: ReapeR13 on May 16, 2013, 04:09:58 AM
 Using:
  1. if (Application.internetReachability != NetworkReachability.NotReachable)
  2.                         {
  3.                                 TNManager.StartUDP(Random.Range(10000, 50000));
  4.                         }

 in " Example Menu" still gives the same " No route to host "  error when wi-fi is disabled.
Title: Re: iOS Errors
Post by: ArenMook on May 16, 2013, 05:37:46 AM
UdpLobbyServer.Start() is what causes it. Lobby server shouldn't be trying to start anything if the internet is not reachable.