Beispiel #1
0
        public void Listen()
        {
            while (true)
            {
                var streamMessage = streamReader.ReadLine();
                var message       = messageMapper.GetMessageFromString(streamMessage);

                InterpretMessage(message);
            }
        }
Beispiel #2
0
        private void HandleMessages(TcpClient tcpClient)
        {
            while (true)
            {
                var stream        = tcpClient.GetStream();
                var streamReader  = new StreamReader(stream);
                var streamMessage = streamReader.ReadLine();
                var message       = messageMapper.GetMessageFromString(streamMessage);

                InterpretMessage(message, tcpClient);

                if (!tcpClient.Connected)
                {
                    break;
                }
            }
        }