Query not found-masterserver.requesthostlist

Hi guys I am using masterserver.requesthostlist and I keep getting the error that the gametype or for me the serverName isn’t found.
I am using:

Public game object derp;

serverName is a string the player enters before the server is even registered, when people hit the join button then the above code begins running so I was wondering if there was a fix to this issue.
Thank You,

In this forum maybe it will help you?

Hello @Kingofweirdos
, I did look into your code and maybe I have found the source of your problem.

I got the same error when I was trying to connect trying to connect via server name, but I should have use GameType.
I think that you are trying to connect via server name, but you should use GameType.
I’ve written a simple code, which should demonstrate that:

using System.Collections;
using System.Collections.Generic;
using UnityEngine.UI;
using UnityEngine;
using UnityEngine.Networking;

public class TestScript : MonoBehaviour {

	public string UniqueGameType;
	public string serverName;
	public string comment;

	void OnMasterServerEvent(MasterServerEvent masterserverevent){
		if (masterserverevent == MasterServerEvent.RegistrationSucceeded) {
			Debug.Log ("RegistrationSucces");
                        //WEIRD LINE
			MasterServer.RequestHostList (UniqueGameType);

	void OnGUI() {
		if (GUILayout.Button ("Start Server"))
			// Use NAT punchthrough if no public IP present
			Network.InitializeServer(32, 25002, !Network.HavePublicAddress());
			MasterServer.RegisterHost(UniqueGameType, serverName, comment);

		if (GUILayout.Button ("Connect"))
			Debug.Log ("Requesting server: " + UniqueGameType);

			MasterServer.RequestHostList (UniqueGameType);

			HostData[] hostData = MasterServer.PollHostList();
			Debug.Log ("Number of servers: "+hostData.Length);
			//write server info to console
			if (hostData.Length > 0) {
				Debug.Log ("Requesting name: " + hostData [0].gameName);
				Debug.Log ("Requesting type: " + hostData [0].gameType);
				Debug.Log ("Requesting ip: " + hostData [0].ip);

Another issue is your idea with loading scenes. I think, that maybe when you load them, Unity will not execute registering host, because it takes a while and you load next scene, before it can finish.

Please take in account, that I dont work with HLAPI and Networking very often. So, for Ex. I have to RequestHostList two times in my code. (Extra request commented as WEIRD LINE :D).
That being said, I hope I’ve helped you and good luck :slight_smile:

Since this question somehow get constantly bumped i want to clear up some things here.

First of all the MasterServer is part of the legacy networking system (RakNet). It’s still in the engine but has nothing to do with the new UNet system. The legacy system shouldn’t be used for new projects.

Furthermore as far as i know Unity has shut down the default development MasterServer they used to host on their own server. So you have to host and use your own MasterServer build. That also means you have to know the IP and port of your masterserver and have to set them. This was always necessary even back then when RakNet was the active networking engine. The development Masterserver which was hosted by Unity was only meant for development testing.

People also seem to confuse what the “GameType” parameter is good for. The point here is that a single MasterServer could handle servers for many different games at once. The GameType is a filtering string. This string should be constant and unique to your game. RequestHostList can only return servers which has been registrated with the exact same gametype string. Think about it like Valves source engine. The “gametype” would be something like “TeamFortress2”, “HalflifeDM”, “Left4Dead”, … So the server browser only shows servers which actually run the desired game.

Next you have to keep in mind that “RequestHostList” is an asynchronous request. It can take several seconds until you actually received the host list and it doesn’t have to arrive at once. That’s why you have to continously call PollHostList() to actually get new results which you should display in a list.

Finally keep in mind that the server who registered itself to the master server is a seperate entity from players which request the host list who wants to join a server. Information typed in by the server creator is not available to other clients. If you use a user typed in “gametype” to register the server, the clients which want to join the server would need to type in the exact same string or the master server won’t return anything. Allowing user gametypes would however cause some problems. When two server creators use the same string (e.g. “MyServer”), all clients which want to join “MyServer” would see those two servers.

Debugging network related issues is really hard from the outside. It’s already quite complicated when you directly work with it as there are many different things which can go wrong. From the information given we can’t deduce what might be the issue here.