Search Unity

Unity Multiplayer Master Server Table not found during query or row removal

Discussion in 'Connected Games' started by luckie12, Nov 8, 2016.

  1. luckie12

    luckie12

    Joined:
    Aug 17, 2014
    Posts:
    155
    Hello,

    I have a problem, i finally was able to build the Master Server and Nat Facilitator in VC2008.
    But now when i try to connect i get on my master server:

    Now, this worked when i used the unity master servers

    this is the code i am using:
    * IS replaced in my code with my servers IP
    Code (csharp):
    1.  
    2.     using UnityEngine;
    3.     using System.Collections;
    4.     using UnityEngine.Rendering;
    5.     using UnityEngine.Networking;
    6.     public class ServerSetup : NetworkBehaviour{
    7.         bool IsHeadless()
    8.         {
    9.             return SystemInfo.graphicsDeviceType == GraphicsDeviceType.Null;
    10.         }
    11.         void Awake()
    12.         {
    13.             MasterServer.ipAddress = "*";
    14.             MasterServer.port = 23466;
    15.             Network.natFacilitatorIP = "*";
    16.             Network.natFacilitatorPort = 50005;
    17.             if (IsHeadless())
    18.             {
    19.                 print("headless mode detected");
    20.                 Debug.Log("I am headless (server)");
    21.                 StartServer();
    22.             }
    23.             if (!IsHeadless())
    24.             {
    25.                 GetServers();
    26.                 Debug.Log("I am a client!");
    27.             }
    28.         }
    29.         void StartServer () {
    30.             Network.InitializeServer(32, 7777, !Network.HavePublicAddress());
    31.             MasterServer.RegisterHost("_TEST_SERVER_2K16_YAY_WOO", "MultiShot", "l33t game for all");
    32.         }
    33.  
    34.         void GetServers()
    35.         {
    36.             MasterServer.RequestHostList("_TEST_SERVER_2K16_YAY_WOO");
    37.             Debug.Log("Trying to get servers");
    38.         }
    39.  
    40.         void OnServerInitialized()
    41.         {
    42.             Debug.Log("Server initialized and ready");
    43.         }
    44.  
    45.         void OnGUI()
    46.         {
    47.             HostData[] data = MasterServer.PollHostList();
    48.             foreach (var element in data)
    49.             {
    50.                 GUILayout.BeginHorizontal();
    51.                 var name = element.gameName + " " + element.connectedPlayers + " / " + element.playerLimit;
    52.                 GUILayout.Label(name);
    53.                 GUILayout.Space(5);
    54.                 string hostInfo;
    55.                 hostInfo = "[";
    56.                 foreach (var host in element.ip)
    57.                     hostInfo = hostInfo + host + ":" + element.port + " ";
    58.                 hostInfo = hostInfo + "]";
    59.                 GUILayout.Label(hostInfo);
    60.                 GUILayout.Space(5);
    61.                 GUILayout.Label(element.comment);
    62.                 GUILayout.Space(5);
    63.                 GUILayout.FlexibleSpace();
    64.                 if (GUILayout.Button("Connect"))
    65.                 {
    66.                     Network.Connect(element);
    67.                     MasterServer.ClearHostList();
    68.                 }
    69.                 GUILayout.EndHorizontal();
    70.             }
    71.         }
    72.     }
    73.  
    Im using a headless client that uses this script too, as you can see on the top.
    When i start the headless client i see connections being send to/from my Master Server, but when i start the game it gives me the above error IN the master server.

    Thanks!
     
    Last edited: Nov 8, 2016
  2. luckie12

    luckie12

    Joined:
    Aug 17, 2014
    Posts:
    155
    i kind of fixed it by doing it in 2 scenes, the only problem is, when i try the host and serverlist on my own pc, it works. But when i upload the server to the actual host it does not even register it, it just keeps saying sent bytes to 8888...
    Scene 1:
    HOST SCENE to be runned on the server
    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4.  
    5. public class ServerHost : MonoBehaviour {
    6.  
    7.     // Use this for initialization
    8.     void Start () {
    9.         MasterServer.ipAddress = "0.0.0.0";
    10.         MasterServer.port = 23466;
    11.         Network.natFacilitatorIP = "0.0.0.0";
    12.         Network.natFacilitatorPort = 50005;
    13.     }
    14.  
    15.     void OnGUI()
    16.     {
    17.         if(GUILayout.Button("Start Server"))
    18.         {
    19.             Network.InitializeServer(32, 8888, !Network.HavePublicAddress());
    20.         }
    21.         if(GUILayout.Button("Register Server"))
    22.         {
    23.             MasterServer.RegisterHost("TESTGINGEDEVIL", "Multischat", "Lol!");
    24.         }
    25.         if (GUILayout.Button("Disconnect"))
    26.         {
    27.             Network.Disconnect();
    28.         }
    29.     }
    30. }
    31.  
    and then the server list scene:

    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4.  
    5. public class ServerList : MonoBehaviour {
    6.  
    7.     private Rect windowRect = new Rect(100, 0, 400, 400);
    8.     void Start()
    9.     {
    10.         MasterServer.ipAddress = "0.0.0.0";
    11.         MasterServer.port = 23466;
    12.         Network.natFacilitatorIP = "0.0.0.0";
    13.         Network.natFacilitatorPort = 50005;
    14.     }
    15.     void OnGUI()
    16.     {
    17.  
    18.         windowRect = GUI.Window(0, windowRect, windowServers, "Servers");
    19.     }
    20.  
    21.     void windowServers(int id)
    22.     {
    23.  
    24.         if (GUILayout.Button("Refresh"))
    25.         {
    26.             MasterServer.RequestHostList("TESTGINGEDEVIL");
    27.         }
    28.         GUILayout.BeginHorizontal();
    29.  
    30.         GUILayout.Box("Server Name");
    31.  
    32.         GUILayout.EndHorizontal();
    33.  
    34.         if (MasterServer.PollHostList().Length != 0)
    35.         {
    36.             HostData[] data = MasterServer.PollHostList();
    37.             foreach (HostData c in data)
    38.             {
    39.                 GUILayout.BeginHorizontal();
    40.                 GUILayout.Box(c.gameName);
    41.                 if (GUILayout.Button("Connect"))
    42.                 {
    43.                     Network.Connect(c);
    44.                     Debug.Log(c.gameName + c.ip);
    45.                 }
    46.                 GUILayout.EndHorizontal();
    47.             }
    48.         }
    49.  
    50.     }
    51.  
    52. }
    53.  
    *0.0.0.0 is changed in my script :)
     
    Last edited: Nov 9, 2016