diff options
author | Jacques Samain <jsamain+fdio@cisco.com> | 2017-07-11 17:10:08 +0200 |
---|---|---|
committer | Jacques Samain <jsamain+fdio@cisco.com> | 2017-07-11 17:10:08 +0200 |
commit | a5e5e17d29cdc964917a77871f52cfb27ac19e31 (patch) | |
tree | 2b0501794dfbdef3f25b4df8cad7188372e9ab54 | |
parent | e02a10dac7d80b3ee025a3a605d1016006e539f6 (diff) |
Adding the option to set the binding port
Change-Id: Ibc6ab07c5430f923310771195e913616efb654ab
Signed-off-by: Jacques Samain <jsamain+fdio@cisco.com>
-rw-r--r-- | main.cc | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -79,10 +79,10 @@ int main(int argc, char **argv) { string root_folder = "/var/www/html"; string webserver_prefix = "http://webserver"; string proxy_address = ""; - + int port = 8080; int opt = 0; - while ((opt = getopt(argc, argv, "p:l:hx:")) != -1) { + while ((opt = getopt(argc, argv, "p:l:o:hx:")) != -1) { switch (opt) { case 'p': @@ -94,6 +94,9 @@ int main(int argc, char **argv) { case 'x': proxy_address = optarg; break; + case 'o': + port = atoi(optarg); + break; case 'h': default: usage(argv[0]); @@ -119,7 +122,7 @@ int main(int argc, char **argv) { std::cout << "Using locator: [" << webserver_prefix << "]" << std::endl; boost::asio::io_service io_service; - HttpServer server(8080, webserver_prefix, 50, 5, 300, io_service); + HttpServer server(port, webserver_prefix, 50, 5, 300, io_service); // GET for the path /info // Responds with some server info |