Example #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(new IPEndPoint(IPAddress.Parse(Utils.GetLocalIPAddress()), _unicastPort));
            }
            udpListener.U = _unicastClient;
            _unicastClient.BeginReceive(UnicastReceiveCallback, udpListener);
        }
Example #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);
                _multicastClient.JoinMulticastGroup(IPAddress.Parse(_multicastIp));
            }
            udpListener.U = _multicastClient;
            _multicastClient.BeginReceive(MulticastReceiveCallback, udpListener);
        }