From a5e5e17d29cdc964917a77871f52cfb27ac19e31 Mon Sep 17 00:00:00 2001 From: Jacques Samain Date: Tue, 11 Jul 2017 17:10:08 +0200 Subject: Adding the option to set the binding port Change-Id: Ibc6ab07c5430f923310771195e913616efb654ab Signed-off-by: Jacques Samain --- main.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/main.cc b/main.cc index ab661d77..e5eb804e 100644 --- a/main.cc +++ b/main.cc @@ -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 -- cgit 1.2.3-korg