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?