culturered_client/PhotoDisplay/ZMQServer.h

29 lines
441 B
C
Raw Normal View History

2024-09-07 03:34:44 +00:00
#pragma once
#include <atomic>
#include <QThread>
#include "zmq.hpp"
class ZMQServer : public QThread {
Q_OBJECT
public:
explicit ZMQServer(QObject* param = nullptr);
~ZMQServer() override = default;
bool Start(quint16 port);
void Stop();
Q_SIGNALS:
void MessageReady(const QString& Message);
protected:
void run();
private:
zmq::context_t ctx_;
zmq::socket_t socket_;
int port_{ 9527 };
std::atomic_bool stop_{ true };
};