Пример #1
0
        /// <summary>
        /// Listen for Unicast SSDP Responses
        /// </summary>
        private void UnicastSetBeginReceive()
        {
            var ipRxEnd     = new IPEndPoint(IPAddress.Any, _unicastPort);
            var udpListener = new UdpState {
                E = ipRxEnd
            };

            if (_unicastClient == null)
            {
                _unicastClient = new UdpClient(_unicastPort);
            }
            udpListener.U = _unicastClient;
            _unicastClient.BeginReceive(UnicastReceiveCallback, udpListener);
        }
Пример #2
0
        /// <summary>
        /// Listen for Multicast SSDP Responses
        /// </summary>
        private void MulticastSetBeginReceive()
        {
            var      ipSsdp      = IPAddress.Parse(_multicastIp);
            var      ipRxEnd     = new IPEndPoint(ipSsdp, _multicastPort);
            UdpState udpListener = new UdpState {
                E = ipRxEnd
            };

            if (_multicastClient == null)
            {
                _multicastClient = new UdpClient(_multicastPort);
            }
            udpListener.U = _multicastClient;
            _multicastClient.BeginReceive(MulticastReceiveCallback, udpListener);
        }