[zeromq-dev] Binding to TCP port 0

Ian Barber ian.barber at gmail.com
Sun Feb 12 16:20:35 CET 2012


On Sun, Feb 12, 2012 at 8:39 AM, Martin Lucina <martin at lucina.net> wrote:

> Hi Ian!
>
> Thanks for the patch!
>
> You asked me to review it, so here goes...
>

Thanks Mato, I'll update the patch with your suggestions.


> I guess you wanted to use the ZMQ_ENDPOINT_MAX define here rather than
> hardcoding 256?
>

Yep, will do.

I'm not sure I understand what the business with "Allow 0 specifically" is
> about?
>

As far as I could see atoi might return zero if the port is invalid, so
rather than working but potentially confusing code on passing an system
assigned port, the patch looks specifically for * or 0 and checks that, so
the other cases will cause an EINVAL.


> I don't see how this can be solved. Any ideas? Off the top of my head
> trawling through all local interface IP addresses and returning a list of
> endpoints but that rapidly becomes pretty horrible.
>

Yep, I think this is an issue that doesn't have a pleasant solution. I
think the functionality is useful without resolving the interface in that
case - the OP I think wanted just the port for example. I think that the
functionality is useful even with this restriction, and the documentation
can reflect this  case.


> In my opinion this is a major win for libzmq, and is an often misunderstood
> aspect of the library. You don't notice it because it "just works". Many
> times, the reason something has *not* been implemented is that we'd rather
> have no implementation than a theoretically unsound one.
>

Ack, I think this is a good principle, and I can see the questions it
brings to this case.

Ian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20120212/f565aef2/attachment.htm>


More information about the zeromq-dev mailing list