[英]Async read from Poco HTTPClientSession
the usual sample code for using HTTPClientSession goes something like this: 使用HTTPClientSession的常见示例代码如下所示:
Poco::Net::HTTPClientSession session(uri.getHost(), uri.getPort());
std::ostream& ostr = session.sendRequest(req);
// Receive the response.
Poco::Net::HTTPResponse res;
std::istream& rs = session.receiveResponse(res);
the question is, how can I read from the rs input stream the entire data, while making sure that all of operations are non-blocking, so that I can cancel them at any time? 问题是,我如何才能从rs输入流中读取全部数据,同时确保所有操作都没有阻塞,以便我可以随时取消它们?
Just an idea, Try to put your code inside a thread. 只是一个想法,请尝试将您的代码放入线程中。
http://pocoproject.org/slides/130-Threads.pdf http://pocoproject.org/slides/130-Threads.pdf
Regards 问候
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.