public bool StartAsServer()
{
byte num;
if ((this.m_HostId != -1) || this.m_Running)
{
if (LogFilter.logWarn)
{
Debug.LogWarning("NetworkDiscovery StartAsServer already started");
}
return false;
}
this.m_HostId = NetworkTransport.AddHost(this.m_DefaultTopology, 0);
if (this.m_HostId == -1)
{
if (LogFilter.logError)
{
Debug.LogError("NetworkDiscovery StartAsServer - addHost failed");
}
return false;
}
if (!NetworkTransport.StartBroadcastDiscovery(this.m_HostId, this.m_BroadcastPort, this.m_BroadcastKey, this.m_BroadcastVersion, this.m_BroadcastSubVersion, this.m_MsgOutBuffer, this.m_MsgOutBuffer.Length, this.m_BroadcastInterval, out num))
{
if (LogFilter.logError)
{
Debug.LogError("NetworkDiscovery StartBroadcast failed err: " + num);
}
return false;
}
this.m_Running = true;
this.m_IsServer = true;
if (LogFilter.logDebug)
{
Debug.Log("StartAsServer Discovery broadcasting");
}
UnityEngine.Object.DontDestroyOnLoad(base.gameObject);
return true;
}