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

Pieter Hintjens ph at imatix.com
Thu May 15 09:32:25 CEST 2014


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.


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://0.0.0.0:<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



More information about the zeromq-dev mailing list