[zeromq-dev] Binding to TCP port 0

Pieter Hintjens ph at imatix.com
Thu Jan 26 01:39:02 CET 2012


On Wed, Jan 25, 2012 at 6:19 PM, Martin Lucina <martin at lucina.net> wrote:

> It is disabled because in ZeroMQ, by design, there is no way to work
> with individual underlying connections of a socket. Hence, there is no
> API equivalent to e.g. getsockname() which you could use to get the port
> back from the OS.

The functionality regards binding not connections, this isn't the concern.

> If you can think of a way to make this work, without exposing the
> details of the individual connections to the application, and
> without a backward-incompatible API change, please propose it (or
> even better, make a patch).

Current working code would not break by returning the port number via
the zmq_bind API.

The other solution, if this is too ugly (which is debatable) is via a
zmq_getsockopt call. That was your suggestion previously, iirc. Both
are worth exploring.

I don't recall any valid technical concerns with this change proposal,
it came down to opinion.

-Pieter



More information about the zeromq-dev mailing list