private void OnServerPortChanged() { Logging.Logging.LogInfo("Changing Server Port to " + ServerPort.ToString()); Utility.AsynchronousSocketListener._port = ServerPort; _serverThread.Abort(); Utility.AsynchronousSocketListener server = new Utility.AsynchronousSocketListener(); _serverThread = new System.Threading.Thread(server.DoWork); _serverThread.Start(); }
private void InitNetwork() { Logging.Logging.LogInfo("Initializing Network with Server Port " + ServerPort.ToString() + " and Client Port " + ClientPort.ToString()); Utility.AsynchronousSocketListener._port = ServerPort; Utility.AsynchronousSocketListener server = new Utility.AsynchronousSocketListener(); Utility.AsynchronousSocketListener._onReadCallback = new Utility.AsynchronousSocketListener.OnReadCallback(OnNetworkReadCallback); Utility.AsynchronousSocketListener._onErrorCallback = new Utility.AsynchronousSocketListener.OnReadCallback(OnNetworkErrorCallback); _serverThread = new System.Threading.Thread(server.DoWork); _serverThread.Start(); Utility.AsynchronousClient._port = ClientPort; Utility.AsynchronousClient._onErrorCallback = new Utility.AsynchronousSocketListener.OnReadCallback(OnNetworkErrorCallback); }