开发者

Can't receive multicasts on Windows Server 2008

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.Recei开发者_如何学Pythonve(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?


I have gotten it to work, although I'm not sure what the problem was. It may have been an incorrect firewall configuration on the machine (I am trying to get this application to be firewall friendly) but that is beyond the scope of this thread.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜