title: How to broadcast UDP Packet in Windows Universal App
body: <p>I am working on a windows universal app. I can send a UDP packet over the network to a particular host using the code i  have. I can see the UDP packet being sent to the particular hostname i specify using Wireshark. </p>
  
  <p>I want to broadcast a message to all the nodes on my network.</p>
  
  <p>Here is what i have, this only sends a packet to particular host which works:</p>
  
  <pre><code>   class NetworkInterface
      {
          private DatagramSocket _socket;
  
          public NetworkInterface()
          {
              _socket = new DatagramSocket();
          }
  
          public async void Connect(HostName remoteHostName, string remoteServiceNameOrPort)
          {
              await _socket.ConnectAsync(remoteHostName, remoteServiceNameOrPort);
          }
  
          public async void SendMessage(string message)
          {
              var stream = _socket.OutputStream;
  
              var writer = new DataWriter(stream);
  
              writer.WriteString(message);
  
              await writer.StoreAsync();
          }
      }
  
      NetworkInterface ni = new NetworkInterface();
  
      private void ConnectButton_Click(object sender, RoutedEventArgs e)
      {
          Debug.WriteLine("Clicked!");
          ni.Connect(new HostName("192.168.120.51"), "5321");
          string cmd = "Hello there\r";
  
          ni.SendMessage(cmd);
      }
  </code></pre>
  
  <p>This sends a Hello there message to the host.</p>
  
  <p>I am pretty new to Windows universal app and the framework. Also I couldn't find any specific documentation over Web. Please Help.</p>