ADD: added Listener and Sender

This commit is contained in:
Henry Winkel
2023-02-15 11:15:28 +01:00
parent 97d3a10e8c
commit 01e61cd482
8 changed files with 437 additions and 20 deletions

View File

@@ -0,0 +1,39 @@
#pragma once
#include "WHISPER/Messages/Message.hpp"
#include "WHISPER/whisper.hpp"
#include <atomic>
#include <cstdint>
#include <list>
#include <memory>
#include <vector>
#include <WHISPER/localClients.hpp>
#define ZMQ_BUILD_DRAFT_API 1
#include <zmq.hpp>
#include <zmq_addon.hpp>
namespace WHISPER {
class InternalUDPSender{
private:
/// address to send to
std::string address_;
/// port to send to
std::uint16_t port_;
/// zeromq io contex
zmq::context_t ctx;
/// shared pointer to receiving socket
std::shared_ptr<zmq::socket_t> senderSocket_ = nullptr;
public:
InternalUDPSender(std::string address, std::uint16_t port);
~InternalUDPSender();
void send(WHISPER::Message msg,WHISPER::MsgTopics topic = WHISPER::MANAGEMENT);
};
}