From: qjmann <sou...@gm...> - 2010-11-12 19:32:42
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body text="#000000" bgcolor="#ffffff"> <div class="post-text"> <p><b><strong></strong></b>Documentation contains example <strong>HTTP client</strong>, but I see it works in <strong>blocking mode</strong>:</p> <pre class="prettyprint"><code><span class="pln">http_client</span><span class="pun">::</span><span class="pln">response response </span><span class="pun">=</span><span class="pln"> client</span><span class="pun">.</span><span class="kwd">get</span><span class="pun">(</span><span class="pln">request</span><span class="pun">)</span><span class="pln"></span></code></pre> <p>- this call will stop program execution while waiting for server's response. Is it possible to perform <strong>multiple concurrent requests with cpp_netlib</strong> without spawning multiple threads, as it can be done with ASIO asynchronous sockets? I mean a non-blocking manner, something like this:<br> </p> <p>1) Create single io_service object<br> 2) Create and initialize client objects set (all attached to io_service object just created)<br> 3) Call io_service.poll()<br> 4) Check client objects for responses received<br> 5) If some responses has not been received yet, then goto step 3<br> </p> </div> </body> </html> |