[zeromq-dev] IPC and free ports

Ian Barber ian.barber at gmail.com
Thu Oct 11 22:38:01 CEST 2012

On Thu, Oct 11, 2012 at 5:14 PM, andrea crotti
<andrea.crotti.0 at gmail.com> wrote:

> So suppose I want to make sure that I'm not binding twice, what should I
> do? Check if the file already exists or?


> try:
>      sock.bind(addr)
> except zmq.Error:
>     # loop over until find a free channel

That works, you can also bind to port * and check the
ZMQ_LAST_ENDPOINT sockopt to get what port was chosen by the OS.


More information about the zeromq-dev mailing list