From 254f1dc9e629e9de818672174a6614c6595fb11a Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Mon, 6 Aug 2018 20:20:46 +0200 Subject: Support arbitrary ports and port-range splitting --- src/main_server.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/main_server.cpp') diff --git a/src/main_server.cpp b/src/main_server.cpp index cd84cb9..b2f9425 100644 --- a/src/main_server.cpp +++ b/src/main_server.cpp @@ -10,11 +10,14 @@ #include void initLog() { +/* #ifndef NDEBUG boost::log::core::get()->set_filter(boost::log::trivial::severity >= boost::log::trivial::debug); #else boost::log::core::get()->set_filter(boost::log::trivial::severity >= boost::log::trivial::info); #endif +*/ + boost::log::core::get()->set_filter(boost::log::trivial::severity >= boost::log::trivial::info); } void start(std::function func){ @@ -30,12 +33,14 @@ int main (int argc, char *argv[]){ initLog(); - if(argc < 2){ - BOOST_LOG_TRIVIAL(error) << "Program usage: ./onlineDetectorSimulatorServer
!"; + if(argc < 4){ + BOOST_LOG_TRIVIAL(error) << "Program usage: ./onlineDetectorSimulatorServer
"; return 0; } std::string address = argv[1]; + int firstPort = std::stoi(argv[2]); + int numPorts = std::stoi(argv[3]); // int port = 4002; // @@ -46,9 +51,8 @@ int main (int argc, char *argv[]){ std::vector buf(16000); - std::cout << "Receiving UDP packages: " << std::endl; - - ReceiverThreads(address, 10, 27); + printf("Receving udp packets on ports %u - %u\n", firstPort, firstPort + numPorts); + ReceiverThreads(address, 10, numPorts, firstPort); // for(auto i = 0; i < 27; i++){ // std::function f = [=]() { -- cgit v1.2.3