June 2018
Intermediate to advanced
348 pages
8h 45m
English
The C++ REST SDK programming model is inherently asynchronous in nature, and we can invoke the API calls in a synchronous manner as well. The following program will demonstrate how we can invoke HTTP client API calls asynchronously. The program demonstrates workings of the client side of the HTTP protocol supported by the C++ REST SDK. We use a technique called task continuation (a technique of chaining blocks of code) here to retrieve data from a web page and store it in a local disk file. The C++ REST SDK follows an asynchronous I/O model and we chain operations together. Finally, we invoke the composition using the wait() method:
#include <cpprest/http_client.h> #include <cpprest/filestream.h> ...