在http://www.boost.org/doc/libs/1_39_0/doc/html/boost_asio/example/http/client/async_client.cpp有示例 HTTP 客户端 请帮助我更改最大缓冲区大小,如以下代码中所述(它来自与库一起下载的示例,而不是来自站点):
void handle_write_request(const boost::system::error_code& err)
{
if (!err)
{
// Read the response status line. The response_ streambuf will
// automatically grow to accommodate the entire line. The growth may be
// limited by <b>passing a maximum size to the streambuf constructor</b>.
boost::asio::async_read_until(socket_, response_, "\r\n",
boost::bind(&client::handle_read_status_line, this,
boost::asio::placeholders::error));
}
else
{
std::cout << "Error: " << err.message() << "\n";
}
}
这是响应缓冲区的构造函数:
boost::asio::streambuf response_;
但是编译器说以下代码无效:
boost::asio::streambuf response_(
1024
);
似乎默认缓冲区是512
字节大小的,我需要更大的大小。