summaryrefslogtreecommitdiffstats
path: root/src/main_server.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main_server.cpp')
-rw-r--r--src/main_server.cpp33
1 files changed, 18 insertions, 15 deletions
diff --git a/src/main_server.cpp b/src/main_server.cpp
index 6e936e4..90b3835 100644
--- a/src/main_server.cpp
+++ b/src/main_server.cpp
@@ -1,4 +1,5 @@
#include "UDPServer/UDPServer.h"
+#include "ReceiverThreads/ReceiverThreads.h"
#include <boost/log/core.hpp>
#include <boost/log/trivial.hpp>
@@ -30,9 +31,9 @@ int main (int argc, char *argv[]){
initLog();
std::string address = "localhost";
- int port = 4002;
-
- UDPServer server = UDPServer(address, port);
+// int port = 4002;
+//
+// UDPServer server = UDPServer(address, port);
std::size_t length{32768};
std::size_t lastIndex{0};
@@ -41,6 +42,8 @@ int main (int argc, char *argv[]){
std::cout << "Receiving UDP packages: " << std::endl;
+ ReceiverThreads(address, 10, 27);
+
// for(auto i = 0; i < 27; i++){
// std::function<void(void)> f = [=]() {
// server.recv();
@@ -48,18 +51,18 @@ int main (int argc, char *argv[]){
// start();
// }
- while(true){
- int bytes = server.recv((char*)buf.data(), length);
- std::size_t index = *((std::size_t *)buf.data());
- if(index%1000 == 99) printf("%lu\n", index);
-
- if(lastIndex != (index-1))
- BOOST_LOG_TRIVIAL(warning) << "Packet loss or wrong order!";
-
- lastIndex = index;
-
- BOOST_LOG_TRIVIAL(debug) << "Server: Received " << bytes << " Bytes with Index " << index;
- }
+// while(true){
+// int bytes = server.recv((char*)buf.data(), length);
+// std::size_t index = *((std::size_t *)buf.data());
+// if(index%1000 == 99) printf("%lu\n", index);
+//
+// if(lastIndex != (index-1))
+// BOOST_LOG_TRIVIAL(warning) << "Packet loss or wrong order!";
+//
+// lastIndex = index;
+//
+// BOOST_LOG_TRIVIAL(debug) << "Server: Received " << bytes << " Bytes with Index " << index;
+// }
return 0;