python - How to handle multiple publishers on same port in zmq? -
this question has been asked before, here. have exact same problem. want publish bunch of different processes, , use same port every time.
i tried solution presented in answer, did not work me. error
file "/usr/local/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap self.run() file "/usr/local/lib/python2.7/multiprocessing/process.py", line 114, in run self._target(*self._args, **self._kwargs) file "/home/akay/afk/multi.py", line 18, in to_zmq socket.connect("tcp://*:%s" % port) file "zmq/backend/cython/socket.pyx", line 478, in zmq.backend.cython.socket.socket.connect (zmq/backend/cython/socket.c:4308) zmqerror: invalid argument my code this, taken straight example in zmq docs here , here:
# socket talk server port = '5556' context = zmq.context() socket = context.socket(zmq.sub) print "listening stream...", m socket.bind("tcp://localhost:%s" % port) #change connect bind, per answer above socket.setsockopt(zmq.subscribe, topicfilter) i using python 2.7, , recent version of zmq. idea might doing wrong?
well, error clear:
[...] socket.connect("tcp://*:%s" % port) [...] zmqerror: invalid argument you can't connect *, must specify ip address (the server ip address). if both client , server run on single machine, try localhost or 127.0.0.1.
Comments
Post a Comment