Discussion:
[zeromq-dev] zmqHelper for c++
cibercitizen1
2016-10-13 21:23:55 UTC
Permalink
Hi all.


I've updated zmqHelper.hpp (https://github.com/cibercitizen1/zmqHelper)
two classes over zmq.hpp to make it easier tasks
like sending or receiving multipart (text) messages, polling sockets, etc;
and, in this version, to make sure that a socket cannot be shared
by different threads.

There are two types of sockets: SocketAdaptor and SocketAdaptorWithThread.

SocketAdaptor checks that the thread calling its methods is the same
which created/declared the variable.
SocketAdaptorWithThread runs a new thread with exclusive use to an
enclosed SocketAdaptor.
he constructor expects a function that will be executed by the inner thread.

You can find code examples for general cases:
REQ-REP, PUB-SUB, a chat (REQ+SUB in the guest, REP+PUB in the coordinator),
a ROUTER-DEALER proxy (with polling), and a multithreaded ROUTER server
(ROUTER frontend, REQ-inproc to the workers)

Any comment is welcome. Thanks.

cc1

Loading...