Skip to content

Instantly share code, notes, and snippets.

@h2suzuki
Last active March 3, 2017 05:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save h2suzuki/2bd49dfd4f4f5b71029b55d5434f716a to your computer and use it in GitHub Desktop.
Save h2suzuki/2bd49dfd4f4f5b71029b55d5434f716a to your computer and use it in GitHub Desktop.
import numpy as np
import zmq
import zmq_utils
# Setup ZeroMQ image publisher & receiver
context = zmq.Context()
sub = context.socket(zmq.SUB)
sub.setsockopt_string(zmq.SUBSCRIBE, "image")
sub.set_hwm(1)
sub.connect("tcp://localhost:5558")
pub = context.socket(zmq.PUB)
pub.set_hwm(1)
pub.connect("tcp://localhost:5559")
print("Starting...")
while True:
image = zmq_utils.recv_image(sub)
zmq_utils.send_image(pub, image)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment