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


                                          
_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to