示例#1
0
        private void ReceivePackets(object obj)
        {
            if (!Settings.ListenPort.HasValue)
            {
                throw new Exception("The listen port is not identified");
            }

            using (var client = new UdpClient(Settings.ListenPort.Value))
            {
                while (!Token.IsCancellationRequested)
                {
                    byte[] msg = client.ReceiveEx(_cancelUdpClient);
                    _inputCache.Push(msg);
                }
            }
        }