[zeromq-dev] FW: Help With Regard To the ZMQ Forwarder

Symbian Projects proj_symbian at live.com
Thu Mar 15 11:52:06 CET 2012


Hello All,

I am trying to use ZMQ forwarder device , my use case 
is simple, i have two three clients and i want then send and receive 
message together.

I am using the following method to start my forwarder device:

import zmq

def startForwarder():
    context = zmq.Context(1)
    incoming = context.socket(zmq.SUB)

    try:
        incoming.connect("tcp://127.0.0.1:5551");
        incoming.setsockopt(zmq.SUBSCRIBE, "")
    except:
        print("incoming socket is already open")

    try:
        outgoing = context.socket(zmq.PUB)
        outgoing.bind('tcp://127.0.0.1:5562')
    except:
        print("outgoing socket is also open close it")

    zmq.device(zmq.FORWARDER, incoming, outgoing)
    


startForwarder()

It
 works ok for the first time but the next time i start it doesnt bind to
 the outgoing PUB port always gives me error something like :

 line 15, in startForwarder
    outgoing.bind('tcp://127.0.0.1:5562')
  File "socket.pyx", line 489, in zmq.core.socket.Socket.bind (zmq\core\socket.c:4797)
ZMQError: Address in use

Can anybody help me on this.

Thanks,
Ronald












 		 	   		   		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20120315/8afc1919/attachment.htm>


More information about the zeromq-dev mailing list