开发者

Can cpp_netlib perform asynchronous concurrent requests?

开发者 https://www.devze.com 2023-01-24 09:52 出处:网络
cpp_netlib docs contains example HTTP client, but I see it works only in blocking mode: http_client::response response = client.get(request);

cpp_netlib docs contains example HTTP client, but I see it works only in blocking mode:

http_client::response response = client.get(request);

-- this (as I guess) will stop pr开发者_运维知识库ogram execution while waiting for server's response. Can I perform multiple concurrent requests with cpp_netlib without spawning multiple threads? I mean a non-blocking manner, something like cyclical calling of io_service.poll() and using callback handlers to catch responses - and also some additional processing while waiting for response(s).


It is possible to handle asynchronous connections in non-blocking manner using a typedef with an asynchronous tag:

typedef boost::network::http::basic_client<
  boost::network::http::tags::http_async_8bit_udp_resolve
  , 1, 0> http_client;

But currently there's no ability to implement full-featured concurrent connections handling, with callbacks and cyclical checking for requests completion. Not with current 0.7 version of the library, and not with next 0.8. Maybe, these features will be implemented in cpp_netlib 0.9.

For more details, look at cpp_netlib mailing list archieve: http://sourceforge.net/mailarchive/message.php?msg_name=AANLkTingb%2BB06YVyK%3D-XYAcZsQ2sZc%3DE%3DTPhAgcfjrTb%40mail.gmail.com

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号