0
    string sMulticastAddress = "239.255.255.250";
    UdpClient uc = new UdpClient();
    uc.JoinMulticastGroup(IPAddress.Parse(sMulticastAddress));
    IPEndPoint iep = new IPEndPoint(IPAddress.Parse(sMulticastAddress), 3702);
    byte[] abFoo = Encoding.ASCII.GetBytes("This is a test");
    for (int i= 0; i < 100; i++)
    {
        uc.Send(abFoo, abFoo.Length, iep);
    }

The above code runs, but it does not seem to send out anything based on the trace of Wireshark. However, if I change sMulticastAddress to any other address such as 239.255.255.251, 239.255.255.248, 239.255.255.249, it works perfectly. Wireshark captures every packet("This is a test") sent by it. I do not know what makes 239.255.255.250 so special. I am testing it on Windows 10. I have tried turning off Firewall. This is a UWP app. I have another UWP app that uses DatagramSocket to multicast to the same address on the same computer, and it works. This means the problem is probably related to UdpClient. I am wondering if anyone could offer a tip on the possible causes.

Hong
  • 17,643
  • 21
  • 81
  • 142
  • 1
    239.255.255.250 is the address of the [SSDP](https://en.wikipedia.org/wiki/Simple_Service_Discovery_Protocol) protocol. Perhaps UWP is "protecting" you... – C. Gonzalez May 14 '19 at 20:37
  • As I mentioned, another UWP app with exactly the same configuration works fine. It uses DatagramSocket. – Hong May 15 '19 at 01:10
  • Why the port is 3702 but not 1900? – Nico Zhu May 15 '19 at 03:14
  • @NicoZhu-MSFT https://en.wikipedia.org/wiki/WS-Discovery – Hong May 15 '19 at 03:25
  • I don't find `UdpClient` class in uwp document, could share more about it, and in uwp we often use `DatagramSocket` to send UDP packets, Why do you use `UdpClient` ? – Nico Zhu May 15 '19 at 06:56
  • @NicoZhu-MSFT I am developing UWP with Uno platform: https://platform.uno/ This is interesting. – Hong May 15 '19 at 14:39

0 Answers0