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:
Thanks
Kavya
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