summaryrefslogtreecommitdiffstats
path: root/src/ReceiverThreads
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2018-08-06 20:20:46 +0200
committerSuren A. Chilingaryan <csa@suren.me>2018-08-06 20:20:46 +0200
commit254f1dc9e629e9de818672174a6614c6595fb11a (patch)
tree39786da7f579f3098c5a79fe9c129dae2fd3ef5c /src/ReceiverThreads
parent7ae5d89c48bd3982626afe03891eab2e2d31e746 (diff)
downloadods-254f1dc9e629e9de818672174a6614c6595fb11a.tar.gz
ods-254f1dc9e629e9de818672174a6614c6595fb11a.tar.bz2
ods-254f1dc9e629e9de818672174a6614c6595fb11a.tar.xz
ods-254f1dc9e629e9de818672174a6614c6595fb11a.zip
Support arbitrary ports and port-range splitting
Diffstat (limited to 'src/ReceiverThreads')
-rw-r--r--src/ReceiverThreads/ReceiverThreads.cpp5
-rw-r--r--src/ReceiverThreads/ReceiverThreads.h2
2 files changed, 4 insertions, 3 deletions
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 <boost/log/trivial.hpp>
-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: