Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - xarasu

Pages: [1]
1
TNet 3 Support / Re: 1.9.5 Server mismatch
« on: June 24, 2014, 02:18:16 PM »
Works again with 1.9.5c. Thanks for the fix!

2
TNet 3 Support / Re: NaCl support?
« on: June 23, 2014, 09:48:46 AM »
We're looking at using NaCl to support chromebooks with our game, but might have to just have to wait for WebGL in Unity 5.

3
TNet 3 Support / NaCl support?
« on: June 20, 2014, 02:14:20 PM »
Just curious if you've ever gotten tnet working in NaCl? I know the web player can't do udp or start a server, but wasn't sure for NaCl.

4
TNet 3 Support / Re: 1.9.5 Server mismatch
« on: June 18, 2014, 09:50:29 AM »
Updated TNServer.exe and now whenever I try and connect to it with my Unity app, the server crashes with the following "Problem Details":

  1. Description:
  2.   Stopped working
  3.  
  4. Problem signature:
  5.   Problem Event Name:   CLR20r3
  6.   Problem Signature 01: tnserver.exe
  7.   Problem Signature 02: 0.0.0.0
  8.   Problem Signature 03: 53a0e07d
  9.   Problem Signature 04: TNServer
  10.   Problem Signature 05: 0.0.0.0
  11.   Problem Signature 06: 53a0e07d
  12.   Problem Signature 07: 93
  13.   Problem Signature 08: 112
  14.   Problem Signature 09: System.NullReferenceException
  15.   OS Version:   6.1.7601.2.1.0.272.7
  16.   Locale ID:    1033
  17.  
  18. Read our privacy statement online:
  19.   http://go.microsoft.com/fwlink/?linkid=104288&clcid=0x0409
  20.  
  21. If the online privacy statement is not available, please read our privacy statement offline:
  22.   C:\Windows\system32\en-US\erofflps.txt
  23.  

I'm starting it with:
  1. C:\TNServer.exe -tcpLobby 5129

5
TNet 3 Support / 1.9.5 Server mismatch
« on: June 17, 2014, 03:46:57 PM »
I just updated to TNet 1.9.5 and copied the new TNServer.exe over to my host. My app can no longer connect and gives the following warning:

Quote
Version mismatch! Server is running protocol version 10 while you are on version 11
UnityEngine.Debug:LogWarning(Object)
TNTcpLobbyClient:Update() (at Assets/Vendor/TNet/Client/TNTcpLobbyClient.cs:108)

I also tried to build my own TNServer.exe in case it just wasn't up to date and was getting a lot of errors about 'BinaryWriter' not containing a definition for 'writeObject' or 'readObject'.

6
TNet 3 Support / Re: Trouble with discovering local servers on ipad
« on: May 27, 2014, 11:15:18 AM »
Even hosting the game on the pc doesn't help, but direct connections work to any of the devices. I'm assuming this means I'll need a dedicated tcp lobby with a static ip that all my clients will connect to? Is the TNServer.exe able to handle that by itself?

Like:
  1. TNServer.exe -tcpLobby 5129

7
TNet 3 Support / Re: Trouble with discovering local servers on ipad
« on: May 23, 2014, 01:58:07 PM »
Also built out the TNet example menu with the chat scene. On both wifi networks, the iPads didn't 'discover' each other's servers, but on one of them, I could connect to chat by directly putting in the ip address / port. On the other, I couldn't connect at all.

8
TNet 3 Support / Re: Trouble with discovering local servers on ipad
« on: May 23, 2014, 12:35:41 PM »
Yes, I do mean "Host". and "IsConnected/IsConnecting" were artifacts from when I was using the pure Unity networking code, but thanks for the heads up. I've changed over to using the udp lobby for discovering hosts on the LAN and it works fine when I'm running a PC build and unityEditor build. After I found that you need to join a channel to send out rfc messages? they can discover each other fine and connect. However, when I create an iPad build, they can't see each other or the pc builds. Do I need to do anything special for the iPad?

Current Networking Code (trimmed of unnecessary parts):
When the game wants to host, it calls StartServer, when they want to join a game, it calls JoinServer with an access code(this is purely a design choice)
  1. public class Networking : MonoBehaviour {
  2.  
  3.   /**
  4.    * The number of additional times to retry connecting to host
  5.    * */
  6.   public int NumJoinAttempts = 3;
  7.  
  8.   /**
  9.    * Time (in seconds) between each reconnection attempts
  10.    * */
  11.   public int TimeoutTime = 10;
  12.  
  13.   public int serverTcpPort = 5127;
  14.  
  15.   // Use this for initialization
  16.   void Start () {
  17.     TNManager.StartUDP(Random.Range(10000, 50000));
  18.   }
  19.  
  20.   void OnApplicationQuit(){
  21.     TNServerInstance.Stop("server.dat");
  22.   }
  23.  
  24.   public void StartServer(string accessCode) {
  25.     int udpPort = Random.Range(10000, 40000);
  26.     TNUdpLobbyClient lan = GetComponent<TNUdpLobbyClient>();
  27.     int lobbyPort = (lan !=null) ? lan.remotePort : 0;
  28.     var ip = Network.player.ipAddress;
  29.     var name = accessCode+"%"+ip;
  30.     TNServerInstance.serverName = name;
  31.     TNServerInstance.Start(serverTcpPort, udpPort, "server.dat", lobbyPort);
  32.     TNManager.Connect(ip, serverTcpPort);
  33.   }
  34.  
  35.   public void JoinServer(string accessCode) {
  36.     StartCoroutine(AttemptJoinServer(accessCode, 0));
  37.   }
  38.  
  39.   IEnumerator AttemptJoinServer(string accessCode, int attempt) {
  40.     // Check currently known servers for given access code
  41.     var list = TNLobbyClient.knownServers.list;
  42.     foreach (var server in list) {
  43.       var splitName = server.name.Split('%');
  44.       if (splitName[0] == accessCode) {
  45.         var ip = splitName[1];
  46.         TNManager.Connect(ip, serverTcpPort);
  47.         yield break;
  48.       }
  49.     }
  50.     yield return new WaitForSeconds(TimeoutTime);
  51.  
  52.     // Check if already connected to the server
  53.     if (TNManager.isConnected || TNManager.isTryingToConnect)
  54.       yield break;
  55.  
  56.     if (++attempt <=NumJoinAttempts) {
  57.       OnTimeOutHandlers(true, attempt, NumJoinAttempts);
  58.       StartCoroutine(AttemptJoinServer(accessCode, attempt));
  59.     }
  60.     else
  61.       OnTimeOutHandlers(false, attempt, NumJoinAttempts);
  62.   }
  63.  
  64.   void OnNetworkConnect(bool success, string message) {
  65.     if (!success) return;
  66.     TNManager.JoinChannel(1, "");
  67.   }
  68.  
  69.   void OnNetworkJoinChannel(bool success, string message) {
  70.     if (!success) return;
  71.  
  72.     if (!TNManager.isHosting) {
  73.       OnJoinChannelHandlers(true);
  74.     }
  75.   }
  76. }

9
TNet 3 Support / Trouble with discovering local servers on ipad
« on: May 14, 2014, 12:24:16 PM »
I have an app where a user on an ipad can either create or join a server with a given access code (like NY2Z). The clients broadcast out the code to the LAN and the server is supposed to check the code with its own, then respond to the client with its ip address so the client can then connect. But the server doesn't even seem to be getting the initial broadcasted RFC. Am I not connecting in the right order? or could it be an issue with the ipads/router?


  1. public class NetworkingScript: MonoBehaviour {
  2.  
  3.   public TNObject TNO;
  4.  
  5.   public bool IsConnected {get; private set;}
  6.   public bool IsConnecting {get; private set;}
  7.  
  8.   private const int UDP_BROADCAST_PORT = 5128;
  9.   private const int TCP_CONNECTION_PORT = 5127;
  10.  
  11.   private string AccessCode;
  12.  
  13.   // Use this for initialization
  14.   void Start () {
  15.     TNManager.StartUDP(UDP_BROADCAST_PORT);
  16.   }
  17.  
  18.   public void StartServer(string accessCode) {
  19.     this.AccessCode = accessCode;
  20.     IsConnected = false;
  21.     IsConnecting = true;
  22.    
  23.     TNServerInstance.Start(TCP_CONNECTION_PORT);
  24.     TNManager.Connect("127.0.0.1", TCP_CONNECTION_PORT);
  25.   }
  26.   public void JoinServer(string accessCode) {
  27.     this.AccessCode = accessCode;
  28.     IsConnected = false;
  29.     IsConnecting = true;
  30.  
  31.     TNO.BroadcastToLAN(UDP_BROADCAST_PORT, "RequestServerWithAccessCode", accessCode);
  32.   }
  33.  
  34.   [RFC]
  35.   void RequestServerWithAccessCode(string code) {
  36.     if (IsConnecting || !TNManager.isHosting || AccessCode != code)
  37.       return;
  38.  
  39.     var ip = Network.player.ipAddress;
  40.     var serverCode = AccessCode;
  41.     TNO.BroadcastToLAN(UDP_BROADCAST_PORT, "ReturnRequestServerWithAccessCode", ip, serverCode);
  42.   }
  43.  
  44.   [RFC]
  45.   void ReturnRequestServerWithAccessCode(string ip, string code) {
  46.     if (this.AccessCode == code)
  47.       TNManager.Connect(ip, TCP_CONNECTION_PORT);
  48.   }
  49.  
  50.   void OnNetworkConnect(bool success, string message) {
  51.     if (!success)
  52.       Debug.Log("Error connecting to Server: "+message);
  53.     Debug.Log("Connected to server in channel "+TNManager.channelID);
  54.  
  55.     IsConnected = true;
  56.     IsConnecting = false;
  57.   }
  58. }
  59.  

Pages: [1]