public static void ResetNetworkSystem() { NetworkConnection.ResetRequested = true; ClientConnection = new NetClient(Config); ClientConnection.Start(); NetworkServerList.RefreshMasterServers(); if (SendThread != null && !SendThread.IsCompleted) { SendThread?.Wait(1000); } if (ReceiveThread != null && !ReceiveThread.IsCompleted) { ReceiveThread?.Wait(1000); } NetworkConnection.ResetRequested = false; ReceiveThread = SystemBase.LongRunTaskFactory.StartNew(NetworkReceiver.ReceiveMain); SendThread = SystemBase.LongRunTaskFactory.StartNew(NetworkSender.SendMain); NetworkServerList.RequestServers(); }
public static void AwakeNetworkSystem() { Config.EnableMessageType(NetIncomingMessageType.ConnectionLatencyUpdated); Config.EnableMessageType(NetIncomingMessageType.NatIntroductionSuccess); Config.EnableMessageType(NetIncomingMessageType.UnconnectedData); #if DEBUG Config.EnableMessageType(NetIncomingMessageType.DebugMessage); //Config.EnableMessageType(NetIncomingMessageType.VerboseDebugMessage); #endif NetworkServerList.RequestServers(); }
public static void StartNetworkSystem() { Config.EnableMessageType(NetIncomingMessageType.ConnectionLatencyUpdated); Config.EnableMessageType(NetIncomingMessageType.NatIntroductionSuccess); Config.EnableMessageType(NetIncomingMessageType.UnconnectedData); ClientConnection = new NetClient(Config); ClientConnection.Start(); NetworkServerList.RefreshMasterServers(); SendThread.Start(TaskScheduler.Default); ReceiveThread.Start(TaskScheduler.Default); NetworkServerList.RequestServers(); }