title: Boost Asio not sending UDP broadcast packets
body: <p>I'm new to ASIO and I'm trying to get a relatively simple UDP broadcast to work and I'm not seeing any packets leave my PC in Wireshark. Is there a configuraton on the <code>io_service</code> or <code>socket</code> that I'm missing? Here's my complete code: </p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;boost/asio.hpp&gt;
  #include &lt;array&gt;
  
  using boost::asio::ip::udp;
  namespace asio = boost::asio;
  
  const char* idnMsg = "*IDN?;";
  
  int main(int argc, char* argv[])
  {
      try
      {
          asio::io_service serv;
  
          boost::system::error_code err;
  
          udp::socket socket(serv);
          socket.open(asio::ip::udp::v4(), err);
          if (!err)
          {
              socket.set_option(udp::socket::reuse_address(true));
              socket.set_option(asio::socket_base::broadcast(true));
  
              asio::ip::udp::endpoint senderEndpoint(asio::ip::address_v4::broadcast(), 7777);
  
              socket.send_to(asio::buffer(idnMsg, 6), senderEndpoint);
              //socket.close(err);
  
              std::array&lt;char, 128&gt; buf;
  
              while (socket.available())
              {
                  asio::ip::udp::endpoint remote;
  
                  size_t len = socket.receive_from(asio::buffer(buf), remote);
  
                  std::cout &lt;&lt; "Received: ";
                  std::cout.write(buf.data(), len);
  
                  buf.fill(0);
              }
          }
          else
              std::cerr &lt;&lt; "Error connecting: " &lt;&lt; err.message() &lt;&lt; std::endl;
      }
      catch (std::exception&amp; e)
      {
          std::cerr &lt;&lt; e.what() &lt;&lt; std::endl;
      }
  
      return 0;
  }
  </code></pre>
  
  <p>You may notice that it bears a striking resemblance to a combination of an asio example and <a href="https://stackoverflow.com/questions/9310231/boostasio-udp-broadcasting">another SO answer</a>. </p>
  
  <p>I'm using Boost.Asio from NuGet in Visual Studio 2015 in Windows 7 x64. If  switching to manually-compiled standalone Asio will help, I will. I plan on doing that in the future anyway, as I have no need for the rest of boost in my current plans. </p>
  
  <p>As I said, I saw no packets leave my PC in Wireshark, and I even have several devices on my network that would respond to that packet, and I saw no responses. </p>
  
  <p>EDIT: This code with standalone ASIO in Linux works fine. But I'm going to need ASIO working on Windows if I'm eventually going to be shipping code with it; cross-platform is great and I'm aiming for that, but Windows is the biggest market. </p>