/// <summary> /// The private method that sends an "advertising" message to the multicast group. /// </summary> private async Task SendMessageAsync() { // Connect to a multicast group IP and send a message to the group. Stream outStream = (await AdvertiserSocket.GetOutputStreamAsync(AdvertiserGroupHost, AdvertiserPort)).AsStreamForWrite(); using (var writer = new StreamWriter(outStream)) { await writer.WriteLineAsync(AdvertiserMessage); await writer.FlushAsync(); } }
public override bool StopAdvertising() { if (AdvertiserSocket != null) { AdvertiserSocket.MessageReceived -= MessageToConnectReceivedFromParticipantAsync; AdvertiserSocket.Dispose(); AdvertiserSocket = null; _timer.Dispose(); return(true); } return(false); }