Quantcast
Channel: WE MOVED to github.com/microsoft/cpprestsdk. This site is not monitored!
Viewing all articles
Browse latest Browse all 4845

New Post: Hello World with C++ REST SDK

$
0
0
Hi Ichibection

In the above code, I see that you are opening the listener, attaching a handler to handle GET requests, and then closing the listener. The process will exit immediately after starting. When a browser(client) sends any request, the listener would have already exited. I would suggest waiting for some indication from the user to exit the listener or have the listener listening for certain time interval and then call close. For instance, please see below:
    std::string line;
    std::wcout << U("Hit Enter to close the listener.");
    std::getline(std::cin, line);

    listener.close().wait();
Also, one more suggestion is to add the request handler (.support()) before calling listener.open(). This way, when you open the listener, the listener is ready to respond to requests.

Thanks
Kavya

Viewing all articles
Browse latest Browse all 4845

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>