Downloading HTTP URLs asynchronously in C++

后端 未结 4 1748
轮回少年
轮回少年 2020-12-18 09:23

What\'s a good way to download HTTP URLs (e.g. such as http://0.0.0.0/foo.htm ) in C++ on Linux ? I strongly prefer something asynchronous. My program will have an event l

相关标签:
4条回答
  • 2020-12-18 09:59

    You can use boost::asio to perform async IO operations. Heres an example of an async http client.

    0 讨论(0)
  • 2020-12-18 10:02

    Have you considered Qt's network module? They provide some classes for asynchronous download for example QNetworkAccessManager.

    0 讨论(0)
  • 2020-12-18 10:25

    Qt's QThread instance when run can have it's own event loop. Insides QThread you can have an instance of QHttp and since QHttp uses Qt Event loop to function you have your async Http calls from mail thread. Also note that inter thread communication is very easy.

    Head straight to http://doc.qt.nokia.com and look at the classes's documentation to understand better.

    0 讨论(0)
  • 2020-12-18 10:26

    Libcurl is the way to go. See http://curlpp.org for C++ bindings and an excellent set of tutorials.

    0 讨论(0)
提交回复
热议问题