MasterServer.RequestHostList Manual     Reference     Scripting  
Scripting > Runtime Classes > MasterServer
MasterServer.RequestHostList

static function RequestHostList (gameTypeName : string) : void

Description

Request a host list from the master server.

The list is available through MasterServer.PollHostList when it has arrived.

function Awake() {
// Make sure list is empty and request a new list
MasterServer.ClearHostList();
MasterServer.RequestHostList("LarusTest");
}

function Update() {
// If any hosts were received, display game name, the clear host list again
if (MasterServer.PollHostList().length != 0) {
var hostData: HostData[] = MasterServer.PollHostList();
for (var i:int=0; i<hostData.length; i++) {
Debug.Log("Game name: " + hostData[i].gameName);
}
MasterServer.ClearHostList();
}
}