summaryrefslogtreecommitdiffstats
path: root/src/ReceiverThreads/ReceiverThreads.cpp
diff options
context:
space:
mode:
authorTobias Frust <tobiasfrust@gmail.com>2016-07-21 10:23:08 +0200
committerTobias Frust <tobiasfrust@gmail.com>2016-07-21 10:23:08 +0200
commitebcd23f3d86976fbfe2768d3ee0925db2cff773a (patch)
treec374a6ca77042c31485d6ef9ade11f108436371e /src/ReceiverThreads/ReceiverThreads.cpp
parent8940620375c3bd9fef263fe9352c22384215cb13 (diff)
downloadods-ebcd23f3d86976fbfe2768d3ee0925db2cff773a.tar.gz
ods-ebcd23f3d86976fbfe2768d3ee0925db2cff773a.tar.bz2
ods-ebcd23f3d86976fbfe2768d3ee0925db2cff773a.tar.xz
ods-ebcd23f3d86976fbfe2768d3ee0925db2cff773a.zip
packet size is now configurable
Diffstat (limited to 'src/ReceiverThreads/ReceiverThreads.cpp')
-rw-r--r--src/ReceiverThreads/ReceiverThreads.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/ReceiverThreads/ReceiverThreads.cpp b/src/ReceiverThreads/ReceiverThreads.cpp
index 6f389f2..a99467a 100644
--- a/src/ReceiverThreads/ReceiverThreads.cpp
+++ b/src/ReceiverThreads/ReceiverThreads.cpp
@@ -27,20 +27,21 @@ ReceiverThreads::ReceiverThreads(const std::string& address, const int timeInter
auto ReceiverThreads::receiverThread(const int port) -> void {
UDPServer server = UDPServer(address_, port);
- std::vector<unsigned short> buf(16000);
+ std::vector<unsigned short> buf(33000);
std::size_t lastIndex{0};
BOOST_LOG_TRIVIAL(info) << "Address: " << address_ << " port: " << port << " timeout: " << timeIntervall_;
while(true){
- int bytes = server.timed_recv((char*)buf.data(), buf.size()*sizeof(unsigned short), timeIntervall_);
+ int bytes = server.timed_recv((char*)buf.data(), 65536, timeIntervall_);
if(bytes < 0){
break;
}
+ BOOST_LOG_TRIVIAL(debug) << "Received " << bytes << " Bytes.";
std::size_t index = *((std::size_t *)buf.data());
int diff = index - lastIndex - 1;
if(diff > 0){
- BOOST_LOG_TRIVIAL(warning) << "Packet loss or wrong order! new: " << index << " old: " << lastIndex;
+ loss_ += diff;
+ BOOST_LOG_TRIVIAL(debug) << "Packet loss or wrong order! new: " << index << " old: " << lastIndex;
}
- loss_ += diff;
lastIndex = index;
}
BOOST_LOG_TRIVIAL(info) << "Lost " << loss_ << " from " << lastIndex << " packets; (" << loss_/(double)lastIndex << "%)";