MonoRemoteDebugger.SharedLib.Server.MonoDebugServer.StartListening C# (CSharp) Method

StartListening() private method

private StartListening ( CancellationToken token ) : void
token System.Threading.CancellationToken
return void
        private void StartListening(CancellationToken token)
        {
            while (true)
            {
                logger.Info("Waiting for client");
                if (tcp == null)
                {
                    token.ThrowIfCancellationRequested();
                    return;
                }

                TcpClient client = tcp.AcceptTcpClient();
                token.ThrowIfCancellationRequested();

                logger.Info("Accepted client: " + client.Client.RemoteEndPoint);
                var clientSession = new ClientSession(client.Client);

                Task.Factory.StartNew(clientSession.HandleSession, token).Wait();
            }
        }