Open panecho opened 3 years ago
Hi @ZhengPan2014,
Yes, PUB/SUB works well with send_jpg()
. Your sender code is the PUB (publisher), so it needs a TCP address like this:
sender = imagezmq.ImageSender(connect_to='tcp://*:5555',REQ_REP=False)
The point is that your sender must have "*"
as its TCP address. (or, if "*"
won't work, then try "127.0.0.1"
). When using PUB/SUB, it is the receiver that must specify a numeric tcp address. Comparing receiver and sender addresses in PUB/SUB:
# PUB/SUB example:
# on image sending computer:
image_sender = imagezmq.ImageSender(connect_to='tcp://*:5555', REQ_REP=False) # or can be connect_to='tcp://127.0.0.1:5555’
# on the image receiving computer:
image_hub = imagezmq.ImageHub(open_port='tcp://172.217.14.78:5555', REQ_REP=False) # must specify the address for first sending computer
The docs in this imageZMQ repository contain an example of PUB/SUB with send_jpg:
For a more complete understanding of the TCP addressing of senders versus receivers in PUB/SUB versus REQ/REP, see my reply in issue #43. Let me know if this works for you, Jeff
Hi @ZhengPan2014, Yes, PUB/SUB works well with
send_jpg()
. Your sender code is the PUB (publisher), so it needs a TCP address like this:sender = imagezmq.ImageSender(connect_to='tcp://*:5555',REQ_REP=False)
The point is that your sender must have
"*"
as its TCP address. (or, if"*"
won't work, then try"127.0.0.1"
). When using PUB/SUB, it is the receiver that must specify a numeric tcp address. Comparing receiver and sender addresses in PUB/SUB:# PUB/SUB example: # on image sending computer: image_sender = imagezmq.ImageSender(connect_to='tcp://*:5555', REQ_REP=False) # or can be connect_to='tcp://127.0.0.1:5555’ # on the image receiving computer: image_hub = imagezmq.ImageHub(open_port='tcp://172.217.14.78:5555', REQ_REP=False) # must specify the address for first sending computer
The docs in this imageZMQ repository contain an example of PUB/SUB with send_jpg:
* Sender (PUB) code is [here](https://github.com/jeffbass/imagezmq/blob/master/examples/pub_sub_broadcast.py). * Receiver (SUB) code is [here.](https://github.com/jeffbass/imagezmq/blob/master/examples/pub_sub_receive.py) * Docs for the PUB/SUB example are [here](https://github.com/jeffbass/imagezmq/blob/master/docs/fast-pub-sub.rst).
For a more complete understanding of the TCP addressing of senders versus receivers in PUB/SUB versus REQ/REP, see my reply in issue #43. Let me know if this works for you, Jeff @jeffbass Yes, it works as what you said. But I got another problem. As you know, I try to transport image over the network with imagezmq(long distance in geography location ). time delay is too havily to accept. I need to find the problem causing time delay. Is there any tool to help me to analyze which parts cause it?
Hi @ZhengPan2014, Sorry, I don't have any expertise in network timing or optimization, so I can't be any help with that. I'll leave this issue open in case someone has a suggestion. Good luck, Jeff
@jeffbass Need your help here. I got errors while trying to transport pictures in the format of jpg with message pattern PUB/SUB.
sender.py is as follow(X.X.X.X is ip of server):