From ebcd23f3d86976fbfe2768d3ee0925db2cff773a Mon Sep 17 00:00:00 2001 From: Tobias Frust Date: Thu, 21 Jul 2016 10:23:08 +0200 Subject: packet size is now configurable --- src/ReceiverThreads/ReceiverThreads.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/ReceiverThreads/ReceiverThreads.cpp') 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 buf(16000); + std::vector 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 << "%)"; -- cgit v1.2.3