first version of InternalUDPService
This commit is contained in:
25
src/main.cpp
25
src/main.cpp
@@ -1,9 +1,27 @@
|
||||
#include "WHISPER/InternalUDPService.hpp"
|
||||
#include "WHISPER/Messages/Message.hpp"
|
||||
#include <iostream>
|
||||
#include <loguru.hpp>
|
||||
|
||||
#include <WHISPER/Messages/Join.hpp>
|
||||
#include <WHISPER/Messages/Protos/message.pb.h>
|
||||
#include <memory>
|
||||
|
||||
|
||||
/// variable for stopping the application
|
||||
bool running = true;
|
||||
|
||||
/**
|
||||
* @brief killhandler to set running to false on CTRL-C
|
||||
*
|
||||
* @param s - the signal to manage
|
||||
*/
|
||||
void killHandlerPing(int s) {
|
||||
|
||||
if (s == SIGINT) {
|
||||
running = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int main()
|
||||
@@ -30,7 +48,12 @@ int main()
|
||||
LOG_S(INFO)<< "join message data afer reception "<< receivedJoin.port;
|
||||
break;
|
||||
}
|
||||
auto receiver = std::make_shared<WHISPER::threadSafeQueue<WHISPER::Message>>();
|
||||
WHISPER::InternalUDPService service(1,WHISPER::SHIP,8000,"127.0.0.1");
|
||||
service.connect(receiver);
|
||||
|
||||
|
||||
while (running) {
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(500));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user