private void _resetServers() { _controlServer?.Stop(); _controlServer = null; _dataServer?.Stop(); _dataServer = null; GC.Collect(); }
private void _acceptControlConnection(IAsyncResult ar) { Console.WriteLine("Handshaking"); var listener = (Socket)ar.AsyncState; var handler = listener.EndAccept(ar); _controlServer = new ControlServer(handler, this); _controlServer.Setup(); _controlServer.Start(); _dataServer = new DataServer(_dataConnection); _dataServer.Start(); State = State == StateEnum.WaitingForConnections ? StateEnum.Initializing : StateEnum.Initialized; }