I got this error in my program:
Traceback (most recent call last):
File "scriptA.py", line 17, in <module>
socketPub.bind("tcp://localhost:%s"% portPub)
File "socket.pyx", line 434, in zmq.backend.cython.socket.Socket.bind (zmq/backend/cython/socket.c:3928)
File "checkrc.pxd", line 21, in zmq.backend.cython.checkrc._check_rc (zmq/backend/cython/socket.c:6058)
zmq.error.ZMQError: No such device
This is a simple script I have done to reproduce it:
import zmq
import random
import sys
import time
port = "5566"
if len(sys.argv) > 1:
port = sys.argv[1]
int(port)
portSub = "5556"
context = zmq.Context()
portPub = "5566"
#contextPub = zmq.Context()
socketPub = context.socket(zmq.PUB)
socketPub.bind("tcp://localhost:%s"% portPub)
socket = context.socket(zmq.SUB)
socket.connect("tcp://localhost:%s"% portSub)
socket.setsockopt(zmq.SUBSCRIBE,'')
while True:
socket.send("BB", zmq.SNDMORE)
socket.send("16", zmq.SNDMORE)
socket.send("14", zmq.SNDMORE)
socket.send("11", zmq.SNDMORE)
socket.send("4")
time.sleep(3)
I want to subscribe to one point and be able to send to another one. Is it possible? 2 differents end points. A sends to B and B sends to C.