tags:

views:

336

answers:

2

What is the difference between:

  • boost::asio::tcp::socket::async_read_some()
  • boost::asio::tcp::socket::async_receive()

As far as I can tell their documentation is identical.

Which should I prefer?

+3  A: 

I believe the two are essentially identical. The reason they provide both is to provide interfaces similar to both iostreams (which have a read_some member) and sockets (which have a receive).

Jerry Coffin
Makes sense to me. So I guess he should "prefer" the one matching the interface he'd rather keep compatability with.
T.E.D.
+3  A: 

Their specification in the networking TR2 proposal (5.7.10.2 basic_stream_socket members) is identical too:

On async_receive:

Effects: Calls this->service.async_receive(this->implementation, buffers, 0, handler).

On async_read_some:

Effects: Calls this->service.async_receive(this->implementation, buffers, 0, handler).

So I guess this confirms Jerry's impression.

Éric Malenfant