コード例 #1
0
 private void _resetServers()
 {
     _controlServer?.Stop();
     _controlServer = null;
     _dataServer?.Stop();
     _dataServer = null;
     GC.Collect();
 }
コード例 #2
0
        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;
        }