void set_socket_recv_bufsize(int buffer_size) { boost::asio::socket_base::receive_buffer_size recv_bufsize_option(buffer_size); socket_.set_option(recv_bufsize_option); //std::cout << "set_socket_recv_buffer_size(): " << buffer_size << " bytes" << std::endl; }
future<void> session(ip::tcp::socket s, size_t block_size) { vector<char> buf(block_size); s.set_option(ip::tcp::no_delay(true)); for (;;) { auto n = co_await async_read_some(s, buffer(buf.data(), block_size)); n = co_await async_write(s, buffer(buf.data(), n)); } }