I have done a sample ZeroMQ PGM multicast application and it is working fine.
But reply handling is not working. Is this correct approach or not?
If yes - how to do any reply from a Receiver to the Sender?
Sender:
std::string msg = "hello";
socket->send(msg.c_str(),msg.length(),0);
socket->recv(reply); // Can we do this?
Receiver:
char msg[100] = {0};
std::string reply = "Succ";
socket->recv(msg,100,0);
socket->send(reply.c_str(),reply.length(),0); // Can we do this?
Yes, no!
Yes, the ZeroMQ
pgm://
transport-class does not support this.No, we cannot do this. Neither a
.send()
on aSUB
side, or a.recv()
on aPUB
side.ZMQ_SUB
archetype does not permit any.send()
method.ZMQ_PUB
archetype does not permit any.recv()
method.Q.E.D.
So, how to do that, so as to create a bi-directional signalling?
One has to add also another socket, most probably using a
tcp://
transport class, over which a feedback signalling may take place.ZeroMQ's reverse
.bind()
/.connect()
mechanics are a common practice for doing this in an unstructured, formally uncontrolled / configuration-policy unenforced distributed computing infrastructures.