Is there any advantage in terms of the time it takes to get the data buffer out onto the wire if you use
boost::asio::write(m_socket, asio::buffer(dataOut_, len), asio::transfer_all());
instead of
boost::asio::async_write(m_socket, boost::asio::buffer(hbs, sizeof(hbs)),
boost::bind(&Client::handle_pulse, this,
boost::asio::placeholders::error,
boost::asio::placeholders::bytes_transferred));
The big difference is that the normal write
can block until all is written, while async_write
returns immediately and calls a callback when either all data is written or an error occurs.
I doubt there is any noticeable difference in time from call to the data actually being sent over the wire.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With