title: How do I send a std::vector<char> using Boost::Asio?
body: <p>I've been trying to achieve that for the better part of the day, I'd honestly apreciate any help. Both of my apps, the client and the server started throwing "vector subscript out of range" exceptions.</p>
  
  <p>How does one do this thing <em>properly</em> ?</p>
  
  <hr>
  
  <p>Still trying to figure this out, anyone?</p>
  
  <p>As far as I undestand I'm supposed to create a</p>
  
  <p><code>boost::asio::basic_stream_socket stream;</code>
  And then call :</p>
  
  <p><code>stream.send(boost::asio::buffer(data));</code> ?</p>
  
  <p>I suppose it's perfectly possible to do it asynchronously ?
  What are the differences between :
  <code>basic_stream_socket::send()</code> vs. <code>basic_stream_socket::write_some()</code> vs. <code>basic_stream_socket::async_write_some()</code> ?</p>
  
  <p><code>basic_stream_socket::receive()</code> vs. <code>baic_stream_socket::read_some()</code> vs. <code>basic_stream_socket::async_read_some()</code> ?</p>
  
  <p>I'm assuming that <code>send()</code> &amp; <code>receive()</code> are methods that I can call when I wish to make sure that 100% of data is sent/received - at the expense of blocking the socket?</p>
  
  <p>I'm assuming that <code>write_some()</code> &amp; <code>read_some()</code> are methods that I can call when I'm not sure if 100% of data is sent/received - while still blocking the socket ?</p>
  
  <p>I'm assuming that <code>async_read_some()</code> &amp; <code>async_write_some()</code> are methods that don't block the socket and they read/write whatever they can ?</p>