Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REQ/RESP One sender multiple recievers #77

Open
alejoGT1202 opened this issue Sep 2, 2022 · 1 comment
Open

REQ/RESP One sender multiple recievers #77

alejoGT1202 opened this issue Sep 2, 2022 · 1 comment

Comments

@alejoGT1202
Copy link

Hello,

I would like to know if it's possible to do the following using the REQ/RESP approach instead of PUB/SUB.

I have one device that will be transmitting the images, and I two separate devices that will be processing the images. I would like to send images to both devices only when both of them already finished they respective processes, would it this be possible?
Thanks for the help.

@jeffbass
Copy link
Owner

jeffbass commented Sep 6, 2022

You cannot have multiple RESP receivers for a single REQ sender. The REQ / RESP pattern connects the REQ image sender to one and only one RESP image receiver. It is a consequence of the ZMQ REQ /REP pattern design.

There are 2 ways I can think of to handle sending images from one image sender to multiple image receivers:

  1. Use PUB / SUB instead of REQ / REP. The ZMQ design for PUB / SUB allows multiple subscribers to a single sender.
  2. Set up the REQ image sender with 2 REQ / REP connections, each one with a separate imageZMQ.ImageSender() / imageZMQ.ImageHub() pair connecting to the single REP image receiver. You would need to send each image twice: once using the first connection and then again using the second connection. That would take twice as long per image for transmission, which is likely to be problematic.

You could also use one of the other ZMQ patterns for REQ / REP described in Chapter 3 of the ZMQ Guide. If you do that you would need to write your own code to replace imageZMQ since it does not implement any of these more advanced ZMQ patterns. While the imageZMQ code could be used as a starting point, using the more advanced ZMQ patterns for REQ/REP is likely to be a substantial undertaking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants