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

New Post: CCan't create http_listener object.

$
0
0
Hi all. I tried to create http_listener but all stop in .open function, why? (Windows 7, VS 2013)
Please help.
#include <cpprest\http_listener.h>
#include <cpprest\http_client.h>
#include <iostream>
 
using namespace std;
using namespace web;                        // Common features like URIs.
using namespace web::http;                  // Common HTTP functionality
using namespace web::http::client;
using namespace web::http::experimental::listener;
 
void get_handle(http_request resp)
{
 
}
 
int main(int argc, char** argv)
{
    http_listener listener(U("http://127.0.0.1:8181"));
 
    listener.support(methods::GET, get_handle);
 
    listener.open().then([&listener]()
    {
        cout << "Server start" << endl;
        listener.close();
    }).wait();
 
    cout << "Listener stop" << endl;
 
    system("pause");
    return 0;
}

Viewing all articles
Browse latest Browse all 4845

Trending Articles



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