zeromq / goczmq

goczmq is a golang wrapper for CZMQ.
Mozilla Public License 2.0
591 stars 94 forks source link

"goczmq.Rep" Binds the Port #283

Closed mortymacs closed 3 years ago

mortymacs commented 4 years ago

Hi,

I've tried to address this case but I couldn't, so I came here to ask you all. Sorry for the interruption.

In ZMQ proxy, when a proxy is in Router/Dealer type, then users can connect by Req to the frontend, and Processes can connect by Rep to the backend:

Users -[zmq.Req]-> [Router | Dealer] <-[Rep]- Processes
                           ^
                       Proxy

I use ZMQ in C++ and Python codes and all Rep can connect to the Dealer, but in the goczmq it binds the port. So, processes can't connect to the proxy. It's clear, because the Dealer already binds the port.

What's the idea behind it and how to solve it?

mortymacs commented 3 years ago

I've solved it by copying the code of goczmq.NewRep but I've changed the flag on the Attach method to false.

This is the code:

    c.cxn = zmq.NewSock(zmq.Rep)
    err := c.cxn.Attach(cxnAddr, false)