void client::read_data(char * sourse , int num )
{
boost::asio::read( sp, boost::asio::buffer( sourse , num ) );
}
Buffer 可以换成 boost::streambuf
如:
boost::asio::streambuf response ;
boost::asio::read (sp, response );
而 streambuf 是能过自动扩充的 。
例子:
boost::asio::streambuf response;
boost::asio::read_until(socket, response, "\r\n"); //读到"\r\n"时结束
https://www.cnblogs.com/liaocheng/p/4420902.html