Async operations don't have a "result" until the handler has been scheduled for execution. The result of the operation is sent to the handler.

Therefore, returning a size_t would be meaningless for the async versions of the operations since the number of bytes sent or received is not known when the call returns.

The non-async versions block until there is a result, so they are able to return it directly.

 

On Thu, 14 Jun 2018 at 15:49, Álvaro Cebrián Juan via Boost-users <boost-users@lists.boost.org> wrote:
From the documentation I can see that socket::receive() returns a variable of type "std::size_t", while the asynchronous version socket::async_receive() returns "void". This is also true for socket::send() and socket::async_send().
I was expecting that they would have the same return types, so there might be a good reason behind.

I would be grateful if someone can shed some light on this.

Thank you.

Álvaro
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
https://lists.boost.org/mailman/listinfo.cgi/boost-users