[zeromq-dev] binding to a wildcard tcp port

Pieter Hintjens ph at imatix.com
Fri Oct 26 16:38:49 CEST 2012

On Fri, Oct 26, 2012 at 8:22 PM, Stephen Lord <Steve.Lord at quantum.com> wrote:

> What I had to work out for myself by reading source code was that
> this works:
>     ret = zmq_bind(sock, "tcp://*:*");

This isn't documented in the zmq_bind man page. It should be...

>     ret = zmq_getsockopt(sock, ZMQ_LAST_ENDPOINT, endpoint, &optlen);

Right, as the zmq_getsockopt page says, if you bind to all interfaces
you'll get back an address You can bind to specific IP
addresses. You can also use getifaddrs to discover all interfaces and
bind to each one: This might be worth doing inside libzmq
automatically instead of using INADDR_ANY.


More information about the zeromq-dev mailing list