1

I try send UDP datagram to multicast group "All Nodes" of IPv6 enabled interface (IPv6 address FF02::1, IPv6 Multicast Address Space Registry) in Windows 10, but can't receive it back locally.

Example C# code:

var a1 = new IPEndPoint(IPAddress.Parse("FF02::1%25"), 3366);
var a2 = new IPEndPoint(IPAddress.Parse("::1"), 3366);
var a3 = new IPEndPoint(IPAddress.Parse("fe80::xxxx:xxxx:xxxx:xxxx%25"), 3366);

var u1 = new UdpClient(new IPEndPoint(IPAddress.IPv6Any, 3366));
var u2 = new UdpClient(new IPEndPoint(IPAddress.IPv6Any, 4466));

void rcv(IAsyncResult ar)
{
   IPEndPoint iipe = null;
   var b = u1.EndReceive(ar, ref iipe);

   u1.BeginReceive(rcv, null);

   Console.WriteLine($"{Encoding.UTF8.GetString(b)} from {iipe}");
}

u1.BeginReceive(rcv, null);

u2.Send(Encoding.UTF8.GetBytes("Test1"), 5, a1);
u2.Send(Encoding.UTF8.GetBytes("Test2"), 5, a2);
u2.Send(Encoding.UTF8.GetBytes("Test3"), 5, a3);

where fe80::xxxx:xxxx:xxxx:xxxx%25 is interface link-local scope address, %25 interface index.

I expect all 3 packets, sended to addresses a1, a2, a3 will be received.

a1 - send to multicast group, that includes localhost too

a2 - send to localhost exactly

a3 - send to interface address

But, this code print following:

Test2 from [::1]:4466
Test3 from [fe80::xxxx:xxxx:xxxx:xxxx%25]:4466

Datagrams, sended to addresses a2 & a3 (localhost, and interface address) was succesfully received. Datagram, sended to all nodes missed.

What am I doing wrong?

Michael Hampton
  • 9,737
  • 4
  • 55
  • 96
svk
  • 53
  • 1
  • 7
  • There's a [`MulticastLoopback`](https://learn.microsoft.com/en-us/dotnet/api/system.net.sockets.socket.multicastloopback?view=netframework-4.7.2) property that looks interesting, and that you're not doing anything with (although its default isn't listed, annoyingly) – Damien_The_Unbeliever Oct 22 '18 at 14:21
  • Unfortunately, setting MulticastLoopback property to true doesn’t any effect at all. – svk Oct 23 '18 at 05:35

0 Answers0