AMDG On 06/14/2018 08:04 AM, Álvaro Cebrián Juan via Boost-users wrote:
From the documentation I can see that socket::receive() https://www.boost.org/doc/libs/1_58_0/doc/html/boost_asio/reference/basic_da... returns a variable of type "std::size_t", while the asynchronous version socket::async_receive() https://www.boost.org/doc/libs/1_58_0/doc/html/boost_asio/reference/basic_da... returns "void". This is also true for socket::send() https://www.boost.org/doc/libs/1_58_0/doc/html/boost_asio/reference/basic_da... and socket::async_send() https://www.boost.org/doc/libs/1_58_0/doc/html/boost_asio/reference/basic_da... . I was expecting that they would have the same return types, so there might be a good reason behind.
receive returns the number of bytes received. async_receive cannot return this because it is not known when the call returns. Instead, the size is passed to the read handler.
I would be grateful if someone can shed some light on this.
In Christ, Steven Watanabe