title: How to broadcast a UDP packet on WP7 Mango?
body: <p>I want to send a UDP packet from a phone to the limited broadcast address (IPAddress.Broadcast = 255.255.255.255).</p>
  
  <p>This is what I have so far, and it works in a Windows app:</p>
  
  <pre><code>Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);   
  socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Broadcast, true);   
  
  byte[] data = Encoding.UTF8.GetBytes("test data");   
  
  SocketAsyncEventArgs a = new SocketAsyncEventArgs();   
  
  a.RemoteEndPoint = new IPEndPoint(IPAddress.Broadcast, 11000);   
  a.SetBuffer(data, 0, data.Length);   
  
  a.Completed += new EventHandler&lt;SocketAsyncEventArgs&gt;(delegate(object s, SocketAsyncEventArgs e)
  {
    Console.WriteLine(e.SocketError);
  });
  
  socket.SendToAsync(a);   
  </code></pre>
  
  <p>The SetSocketOption call is required in order to prevent an "access denied" exception. Unfortunately that method doesn't seem to be available on WP7.  The UDP sample code given on the App Hub community site is using multicast to achieve similar results, but the device I'm trying to contact isn't able to deal with multicast.</p>
  
  <p>Is there any way to do this sort of broadcast on Mango?</p>