1

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?
user3666197
  • 1
  • 6
  • 50
  • 92
my2117
  • 143
  • 1
  • 6

1 Answers1

1

Yes, no!

Yes, the ZeroMQ pgm:// transport-class does not support this.

No, we cannot do this. Neither a .send() on a SUB side, or a .recv() on a PUB side.

ZeroMQ API Specification says:

The pgm and epgm transports can only be used with the ZMQ_PUB and ZMQ_SUB socket types.

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.

enter image description here

ZeroMQ's reverse .bind()/.connect() mechanics are a common practice for doing this in an unstructured, formally uncontrolled / configuration-policy unenforced distributed computing infrastructures.

Community
  • 1
  • 1
user3666197
  • 1
  • 6
  • 50
  • 92