[zeromq-dev] Considering ZMQ patterns to many clients - server implementation

Bernardo Augusto García Loaiza botibagl at gmail.com
Fri Feb 9 23:01:16 CET 2018

There is the REQ-REP an d PUB-SUB patterns between others...

[image: fig2.png]
  [image: fig4.png]

How to ZMQ_PUB get the data that send to subscribers?
The ZMQ_PUB process is connected or communicate with some data source ? ...
I guess..

I think that I will should test ... sure ! but ...
A client  ZMQ_REQ socket  such as follow  ...
zmq::context_t context(1);
zmq::socket_t socket(context, ZMQ_REQ);

This REQ socket, can send data to ZMQ_PUB socket server?
zmq::context_t context (1);
zmq::socket_t publisher (context, ZMQ_PUB);

I have some client external entity named Client 1 which send some data via
with the order that data be sent to another peers external entity Client 2,
... , Client 3 , Client n ...

The idea, is that external clients are sending data of a constant way , due
to all it is a collaborative system
in which one client action is received and  visualized on the other
clients, reason by which each client in some point
will be in a process of receive or get events and show in their local
respective workspaces.

That's all it's something like a collaborative environment, similar to
multiplayer game.

According to previous, is right think in a Middleware ZMQ server of
ZMQ_PUB  type
which receive the events of the each external client (this connection is
performed via ZMQ_REQ in case of be possible)
and at the same time each external client are subscribed to this Middleware
ZMQ_PUB server receiving events ...

Is this possible according to ZMQ Architecture and Patterns? or I am wrong?

I need think in that is necessary one middleware/intermediate, which allows
multiple connections to arrive and in each connection multiple messages via

Initially, I have in this moment a REQ-REP ZMQ implementation in which from
a C++ client I send some
data from external client to Python server ZMQ_REP.  The idea is that the
Python Server act like that middleware
and receive:

   - Multiple data from each external C++ client
   - Due to the collaborative nature system, also the connection of more
   than one external c++ client is necessary when two or more users interact
   between them

In this situation I will have n clients sending n requests on a single port

By this reasons the Python server ZMQ_REP should support multiple
connections and messages with the order to be delivery to another c++
clients an I think that the a ZMQ_REP socket server is not suited to this
tasks ... I am right with these affirmation?
I think this, because I am sending data form clients in two moments or
times, and the ZMQ_REP socket only accept the first
socket.send(request)  from a ZMQ_REQ connection and the other is ignored or
my program crash ..

In this answer about of topic
about of similar situation and reference the *ZMQ_ROUTER* sockets figure
and the client server interaction is perform via PUB-SUB pattern.

This response has motivated me to share my situation with you zmq people
in order to obtain some guidance regarding your experience with zeromq.org

My apologies if my case is too long in this message, I did want give wide
detail about it and my proposal about of how to

Thanks for your orientation
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20180209/b152c438/attachment.htm>

More information about the zeromq-dev mailing list