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/ReceiverThreads/ReceiverThreads.cpp | 5 +++-- src/ReceiverThreads/ReceiverThreads.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'src/ReceiverThreads') diff --git a/src/ReceiverThreads/ReceiverThreads.cpp b/src/ReceiverThreads/ReceiverThreads.cpp index e60971e..e5c339b 100644 --- a/src/ReceiverThreads/ReceiverThreads.cpp +++ b/src/ReceiverThreads/ReceiverThreads.cpp @@ -12,11 +12,11 @@ #include -ReceiverThreads::ReceiverThreads(const std::string& address, const int timeIntervall, const int numberOfDetectorModules) +ReceiverThreads::ReceiverThreads(const std::string& address, const int timeIntervall, const int numberOfDetectorModules, const int firstPort) : timeIntervall_{timeIntervall}, numberOfDetectorModules_{numberOfDetectorModules}, address_{address}, loss_{0} { for(auto i = 0; i < numberOfDetectorModules; i++){ - receiverModules_.emplace_back(&ReceiverThreads::receiverThread, this, 4000+i); + receiverModules_.emplace_back(&ReceiverThreads::receiverThread, this, firstPort+i); } for(auto i = 0; i < numberOfDetectorModules; i++){ @@ -56,6 +56,7 @@ auto ReceiverThreads::receiverThread(const int port) -> void { } + printf("Listening %d\n", port); BOOST_LOG_TRIVIAL(info) << "Address: " << address_ << " port: " << port << " timeout: " << timeIntervall_; double coef = 1000. * 1000. * 1000. / 1024. / 1024. / 1024.; diff --git a/src/ReceiverThreads/ReceiverThreads.h b/src/ReceiverThreads/ReceiverThreads.h index 7cb04c0..094652a 100644 --- a/src/ReceiverThreads/ReceiverThreads.h +++ b/src/ReceiverThreads/ReceiverThreads.h @@ -15,7 +15,7 @@ class ReceiverThreads { public: - ReceiverThreads(const std::string& address, const int timeIntervall, const int numberOfDetectorModules); + ReceiverThreads(const std::string& address, const int timeIntervall, const int numberOfDetectorModules, const int firstPort = 4000); auto run() -> void; private: -- cgit v1.2.3