I have the following code which works fine on my Windows 2003 server:
static void Main(string[] args)
{
UdpClient sock = new UdpClient(5353);
IPAddress multicastIP = IPAddress.Parse("224.0.0.251");
IPEndPoint multicastEndpoint = new IPEndPoint(multicastIP, 5353);
sock.JoinMulticastGroup(multicastIP);
IPEndPoint iep = new IPEndPoint(IPAddress.Any, 0);
Console.WriteLine("Ready...");
byte[] data = sock.Receive(ref iep);
...
sock.Close();
}
Yet on my Windows 2008 R2 server (running inside VMWare Workstation with a single network adapter configured as NAT) my application doesn't receive any packets.
If I run wireshark, it shows that the packets are being delivered to the machine (they look correct and they have the right multicast IP and port) but the application layer doesn't receive anyting (it blocks forever in .Receive)
Am I missing something?