title: Boost::ASIO: optimize for minimal traffic, long connection, small messages, passed instantly
body: <p>I am writing a protocol in Boost::ASIO which has the following requirements:</p>
  
  <ol>
  <li>Connections are long-lasting, and should use minimal overhead as possible to "keep alive".</li>
  <li>Messages are small, and need to be passed instantly.</li>
  </ol>
  
  <p>Are there additional TCP socket flags or Boost::ASIO settings I should use?</p>
  
  <pre><code>socket_.set_option(boost::asio::ip::tcp::no_delay(true));   // enable PSH
  socket_.set_option(boost::asio::socket_base::keep_alive(true)); // enable SO_KEEPALIVE
  socket_.set_option(boost::asio::detail::socket_option::integer&lt;SOL_TCP, TCP_KEEPIDLE&gt;(120)); // secs before keepalive probes
  socket_.set_option(boost::asio::detail::socket_option::integer&lt;SOL_TCP, TCP_KEEPINTVL&gt;(10)); // interval between keepalive
  socket_.set_option(boost::asio::detail::socket_option::integer&lt;SOL_TCP, TCP_KEEPCNT(5)); // failed keepalive before declaring dead
  </code></pre>