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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.