0

This code is accessible at 127.0.0.1.

"http_listener listener("http://localhost:13654");"

But... ...I don't know how to set up to connect from the outside.

I tried (0.0.0.0) but failed.

http_listener listener("http://0.0.0.0:13654");

How do I do that?

P.S It is a server that is plugged into a single LAN and has ssh connection from outside.

#include <iostream>
#include <cpprest/http_listener.h>

using namespace std;
using namespace web::http;
using namespace web::http::experimental::listener;

int main(){
    http_listener listener("http://localhost:13654");

    listener.open().then([&listener](){cout << (U("\n start!!\n"));}).wait();
    listener.support(methods::GET, [](http_request req){
            req.reply(status_codes::OK, U("hello wordl"));
            });
    while(true);

    listener.close();
    return 0;
}
Hwan E
  • 566
  • 2
  • 13

1 Answers1

0

To connect from the outside try

http_listener listener("http://*:13654");

and remember to 'allow' your port for incoming connections in your firewall

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
D. Ch
  • 36
  • 3