c++ - Asynchronous download a list of URLs with Boost.Asio -


i novice in asynchronous programming , boost.asio. have basic question. there example on boost.org. use downloading list of links. following client code http asynchronous client.

int main(int argc, char* argv[]) {   try {     if (argc != 3) {       ...       return 1;     }      boost::asio::io_service io_service;     client c(io_service, argv[1], argv[2]);     io_service.run();   }   catch (std::exception& e) {     std::cout << "exception: " << e.what() << "\n";   }   return 0; } 

i see how can download url code. however, couldn't realize how asynchronously (edit: simultaneously?) download list of urls. me change code obtaining purpose?

the asynchrony in sample exists in fact connections handled asynchronously. enables many downloads run simultaneously on single thread (in code sample question, that's main thread).

so sample asynchronous. looking concurrency other code :)

--> execute io_service::run call on separate thread (or other work on thread).


Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -