private async void Init()
{
_Listener = new DatagramSocket();
_Listener.MessageReceived += Listener_MessageReceived;
while (true)
{
try
{
await _Listener.BindServiceNameAsync("6");
break;
}
catch (COMException)
{
var messageDialog = new MessageDialog("Only one usage of each port is normally permitted.\r\n\r\nIs 'Windows IoT Core Watcher' open?", "Port in use");
messageDialog.Commands.Add(new UICommand("Try again", (command) => { }));
await messageDialog.ShowAsync();
}
}
HostName hostname = new HostName("239.0.0.222");
_Listener.JoinMulticastGroup(hostname);
_Settings = ApplicationData.Current.LocalSettings;
_Timer = new Timer(Timer_Callback, null, 1000, 1000);
}