如何在一个函数中发送两个请求

时间:2012-07-15 12:03:33

标签: c++

boost::asio::ip::tcp::iostream stream;
stream.expires_from_now(boost::posix_time::seconds(60));
stream.connect("sitename","http");
    SOME REQUeST
stream.flush();

///////////////// New request to the different  site 


stream.connect("another site","http");
somthink here

stream.flush();

我想我需要关闭连接,但我不知道该怎么做。

1 个答案:

答案 0 :(得分:0)

您正在寻找流对象的成员函数.close (),关闭流后,您可以自由地将其连接到其他位置。

stream.close ();

文档: