- Home /
Unhandled message error when registering host
Hi all,
I've recently made a networking script for a LAN game, but every time I run the game and press the button which executes the Network.InitialzeServer() and MasterServer.RegisterHost() calls, it gives me the following error:
Unhandled message 76 from IP:27011
I've found that this is caused by the MasterServer.RegisterHost() call as my OnServerInitialized() function works normally.
I am attempting to use a local master server and facilitator which I compiled with Visual Studio 2013.
The script:
#pragma strict
var btnX : float;
var btnY : float;
var btnW : float;
var btnH : float;
var player : GameObject;
var spawn : Transform;
var loadCamera : GameObject;
private var gameType : String;
private var gameName : String;
function Start ()
{
btnX = Screen.width * 0.025;
btnY = Screen.width * 0.025;
btnW = Screen.width * 0.1;
btnH= Screen.width * 0.03;
PlayerPrefs.SetString("GameType", "POL_DM");
PlayerPrefs.SetString("PlayerName", "EpicSnareDrum");
gameType = PlayerPrefs.GetString("GameType");
gameName = PlayerPrefs.GetString("PlayerName") + "'s Game";
}
function startServer ()
{
MasterServer.ipAddress = "127.0.0.1";
MasterServer.port = 27011;
Network.InitializeServer(16, 27011, !Network.HavePublicAddress);
}
function OnServerInitialized ()
{
print("Server Started");
MasterServer.RegisterHost(gameType, gameName, "Arr, me hearties!!");
}
function OnMasterSeverEvent(mse : MasterServerEvent)
{
if(mse == MasterServerEvent.RegistrationSucceeded)
{
Network.Instantiate(player, spawn.position, spawn.rotation, 0);
loadCamera.SetActive(false);
}
if(mse == MasterServerEvent.RegistrationFailedGameName)
{
print("Failed, GameName");
}
if(mse == MasterServerEvent.RegistrationFailedGameType)
{
print("Failed, GameType");
}
if(mse == MasterServerEvent.RegistrationFailedNoServer)
{
print("Failed, No Server");
}
}
function OnGUI ()
{
if(GUI.Button(Rect(btnX, btnY, btnW, btnH), "Start Server"))
{
startServer ();
}
if(GUI.Button(Rect(btnX, btnY * 1.2 + btnH, btnW, btnH), "Refresh Hosts"))
{
}
}
Note: it is a WIP.
Thanks in advance.
Answer by funkyllama · Sep 21, 2014 at 09:34 PM
Did you work this out?? I know what your problem is..
Line 32: MasterServer.port = 27011;
you are telling masterserver to connect on port 27011 and this is the port you are using for your game server. Game server and masterserver are two different entities.. The default port for masterserver is 23466, so change line 32 to:
MasterServer.port = 23466;
and the Unknown error 76 will go away ;)
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Master Server don't answer. OnMasterServerEvent never triggered. 1 Answer
How do I make a network? 1 Answer
Problems with network instantiated objects 1 Answer
Rpg Food/Survival script Need help!! 0 Answers