Exemplo n.º 1
0
 private void AddPort_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
 {
     if (session != null)
     {
         ushort port = 0;
         if (ushort.TryParse(Port.Text, out port))
         {
             // Create socket asynchronously, will get callback when it is complete to add the socket to the list
             if (((ComboBoxItem)Protocol.SelectedItem).Content.ToString() == "TCP")
             {
                 session.AddStreamSocketListenerAsync(port);
             }
             else
             {
                 session.AddDatagramSocketAsync(port);
             }
         }
     }
 }