ADD: added Listener and Sender
This commit is contained in:
39
include/WHISPER/InternalUDPSender.hpp
Normal file
39
include/WHISPER/InternalUDPSender.hpp
Normal 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);
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user