예제 #1
0
        public static void MulticastSetBeginReceive()
        {
            IPAddress ipSSDP = IPAddress.Parse(multicastIP);
            IPEndPoint ipRXEnd = new IPEndPoint(ipSSDP, multicastPort);
            UdpState udpListener = new UdpState();
            udpListener.e = ipRXEnd;

            if (udpMulticastClient == null)
                udpMulticastClient = new UdpClient(multicastPort);
            udpListener.u = udpMulticastClient;
            udpMulticastClient.BeginReceive(new AsyncCallback(MulticastReceiveCallback), udpListener);
        }
예제 #2
0
        public static void UnicastSetBeginReceive()
        {
            IPEndPoint ipRXEnd = new IPEndPoint(IPAddress.Any, unicastPort);
            UdpState udpListener = new UdpState();
            udpListener.e = ipRXEnd;

            if (udpUnicastClient == null)
                udpUnicastClient = new UdpClient(unicastPort);

            udpListener.u = udpUnicastClient;
            udpUnicastClient.BeginReceive(new AsyncCallback(UnicastReceiveCallback), udpListener);
        }