What happened to the following simple diagram. All I do is create a UDP advertiser that is multicast for the message, and a listener that joins the multicast group to receive this message, running on the same computer.
string Port = "54153";
HostName Host = new HostName("224.3.0.5");
var L = new DatagramSocket();
L.MessageReceived += (sender2, args) => { };
await L.BindServiceNameAsync(Port);
L.JoinMulticastGroup(Host);
var AdvertiserSocket = new DatagramSocket();
AdvertiserSocket.Control.MulticastOnly = true;
Stream outStream = (await AdvertiserSocket.GetOutputStreamAsync(Host, Port)).AsStreamForWrite();
using (var writer = new StreamWriter(outStream))
{
await writer.WriteLineAsync("MESSAGE");
await writer.FlushAsync();
}
The listener does not receive anything ( MessageReceivednever called). I tried the following options without success:
- Calling and not calling BindServiceNameAsync () for the advertiser.
- Use
MulticastOnlyfor advertiser, listener, or both - Waiting a few seconds after creating one object in front of another.
- Use
255.255.255.255as a host.