c++ – When will boost.asio actually start the transmission and send the data?

boost::asio::ip::tcp::socket uses buffers. I know that when write or async_write is called, the data is just written into the buffers. My question is when will them be actually sent? Or, to be more precise, when will asio actually start the transmission?

From what I know, at least, asio must start the transmission when the buffer is full, so the data can be considered sent in this case. But, what if there’s no more data put into the buffer? Will short data stay in the buffer forever? Do I need to call some flush() APIs to tell asio that “There’s no more for now. Send the data in the buffer right away!” ? If there are no such APIs, how can I ensure the timeliness of transmission?

Read more here: Source link