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 ResetNetworkSystem() { NetworkConnection.ResetRequested = true; BannedPartsResourcesWindow.Singleton.Display = false; if (ClientConnection.Status > NetPeerStatus.NotRunning) { ClientConnection.Shutdown("Disconnected"); Thread.Sleep(1000); } 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); }
public static void ResetNetworkSystem() { NetworkConnection.ResetRequested = true; BannedPartsWindow.Singleton.Display = false; if (ClientConnection?.Status > NetPeerStatus.NotRunning) { ClientConnection.Shutdown("Disconnected"); Thread.Sleep(1000); } //This will set the NetPeerConfiguration locked as FALSE and allow to change MTU and other advanced stuff Config = Config.Clone(); ClientConnection = new NetClient(Config); 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); }
public static void ResetNetworkSystem() { NetworkConnection.ResetRequested = true; if (ClientConnection?.Status > NetPeerStatus.NotRunning) { ClientConnection.Shutdown("Disconnected"); Thread.Sleep(1000); } ClientConnection = new NetClient(Config); ClientConnection.Start(); 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); }
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?.Wait(1000); ReceiveThread?.Wait(1000); ReceiveThread = new Task(NetworkReceiver.ReceiveMain); SendThread = new Task(NetworkSender.SendMain); SendThread.Start(TaskScheduler.Default); ReceiveThread.Start(TaskScheduler.Default); NetworkServerList.RequestServers(); }