title: Poor multicast performance sending using boost::asio on Windows
body: <p>I have a very simple wrapper for boost::asio sockets sending multicast messages:</p>
  
  <pre><code>// header
  class MulticastSender
  {
  public:
  
      /// Constructor
      /// @param ip - The multicast address to broadcast on
      /// @param port - The multicast port to broadcast on
      MulticastSender(const String&amp; ip, const UInt16 port);
  
      /// Sends a multicast message
      /// @param msg - The message to send
      /// @param size - The size of the message (in bytes)
      /// @return number of bytes sent
      size_t send(const void* msg, const size_t size);
  
  private:
  
      boost::asio::io_service m_service;
      boost::asio::ip::udp::endpoint m_endpoint;
      boost::asio::ip::udp::socket m_socket;
  
  };
  
  // implementation
  inline MulticastSender::MulticastSender(const String&amp; ip, const UInt16 port) :
      m_endpoint(boost::asio::ip::address_v4::from_string(ip), port),
      m_socket(m_service, m_endpoint.protocol())
  {
      m_socket.set_option(boost::asio::socket_base::send_buffer_size(8 * 1024 * 1024));
      m_socket.set_option(boost::asio::socket_base::broadcast(true));
      m_socket.set_option(boost::asio::socket_base::reuse_address(true));
  }
  
  inline size_t MulticastSender::send(const void* msg, const size_t size)
  {
      try
      {
          return m_socket.send_to(boost::asio::buffer(msg, size), m_endpoint);
      }
      catch (const std::exception&amp; e)
      {
          setError(e.what());
      }
      return 0;
  }
  
  // read and send a message
  MulticastSender sender(ip, port);
  while(readFile(&amp;msg)) sender.send(&amp;msg, sizeof(msg));
  </code></pre>
  
  <p>When compiled on Windows 7 using Visual Studio 2013, I get throughput of ~11 MB/s, on Ubuntu 14.04 ~100 MB/s. I added timers and was able to validate the <code>send(...)</code> method is the culprit.</p>
  
  <p>I tried with and without antivirus enabled, and tried disabling a few other services with no luck. Some I cannot disable due to permissions on the computer, like the firewall.</p>
  
  <p>I assume there is a service on Windows running that is interfering, or my implementation is missing something that is effecting the application on Windows and not Linux.</p>
  
  <p>Any ideas on what might be cauing this would be appreciated</p>