[zeromq-dev] why rtpapa.py example not running ?
Emile Achadde
emile.achadde at free.fr
Mon Feb 4 10:25:28 CET 2019
Hello,
I am new in 0MQ.
I tried to run the example from there
https://github.com/imatix/zguide2/blob/master/examples/Python/rtpapa.py
I did some corrections to adapt the code to the new 0Mq version.
I am running Debian 9.7 and Python 3.7.0
when run this code waits for something.
Could someone tell me what is wrong is the code below ?
Best regards,
Emile
the code is here:
# encoding: utf-8
#
# Custom routing Router to Papa (ROUTER to REP)
#
# Author: Jeremy Avnet (brainsik) <spork(dash)zmq(at)theory(dot)org>
#
# https://github.com/imatix/zguide2/blob/master/examples/Python/rtpapa.py
# added 'b' in setsockopt and send commands
import time
import zmq
import zhelpers
context = zmq.Context()
client = context.socket(zmq.ROUTER)
client.bind("ipc://routing.ipc")
worker = context.socket(zmq.REP)
worker.setsockopt(zmq.IDENTITY, b"A")
worker.connect("ipc://routing.ipc")
# Wait for sockets to stabilize
time.sleep(1)
client.send(b"A", zmq.SNDMORE)
client.send(b"address 3", zmq.SNDMORE)
client.send(b"address 2", zmq.SNDMORE)
client.send(b"address 1", zmq.SNDMORE)
client.send(b"", zmq.SNDMORE)
client.send(b"This is the workload")
# Worker should get just the workload
zhelpers.dump(worker)
# We don't play with envelopes in the worker
worker.send(b"This is the reply")
# Now dump what we got off the ROUTER socket...
zhelpers.dump(client)
More information about the zeromq-dev
mailing list