[zeromq-dev] q: how to announce a DSN when using "tcp://*:*"

Michael Haberler mail17 at mah.priv.at
Fri May 16 07:18:23 CEST 2014

Am 15.05.2014 um 09:32 schrieb Pieter Hintjens <ph at imatix.com>:

> Sorry for the slow answer.
> I suspect your cludge is probably the best way to do this. Or, iterate
> on all interfaces (CZMQ does this for zbeacon) and bind/announce each
> one separately.

I could do that, but that would push several URI's to the using side, and with it the problem of which one to choose

given there is a chance one of those URI's cant be connected to; say if the IP address is on a private network, an approach with several URI's would be more robust

I wouldnt quite see how a client should deal with that generous offer - try the URI's in turn and see if there's a response?

I'd love to see a solution to this with less manual massage of setup - just a support problem in the making


- Michael

> On Fri, May 9, 2014 at 3:19 PM, Michael Haberler <mail17 at mah.priv.at> wrote:
>> I'm using DNS-SD for service discovery, and would like to bind sockets like tcp://*:* - i.e. all interfaces, and choose an ephemeral port
>> it would be nice if the DSN retrieved from the ZMQ_LAST_ENDPOINT could be used for this; however, int the case of tcp://*:* (i.e INADDR_ANY) that comes out as 'tcp://<ephemeral port>', and that is not something which can be announced as an endpoint.
>> I have a workaround but it's a bit kludgy: specify a preference list of interfaces/interface patterns (eg pref='eth wlan usb') and pick an interface that is up, matches the list, and has a suitable IP address; then bind to 'tcp://<interface>:*' . In that case  ZMQ_LAST_ENDPOINT gives me a  connectable DSN, and that I announce via DNS-SD. But it means just one IP address is bound, and announced.
>> An alternative is to drop the concept of a URI being announced, and just use the hostname and port number from the DNS-SD announcement; the client constructs a URI from host and port, and connects. That assumes the host being announced is among the IP addresses bound to by zmq_bind(), and that IP address is routable (i.e. not a private non-routed address space). I might not fully understand the way avahi works and if that is actually a problem.
>> I'd be interested in suggestions how to deal with this
>> thanks in advance
>> - Michael
>> _______________________________________________
>> zeromq-dev mailing list
>> zeromq-dev at lists.zeromq.org
>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev

More information about the zeromq-dev mailing list