[zeromq-dev] automatically choosing a free TCP port

Martin Sustrik sustrik at 250bpm.com
Tue Mar 16 11:15:07 CET 2010


Martin Lucina wrote:
> Dave,
> 
> zxvdr.au at gmail.com said:
>> I'll see if I can find some time to investigate this further. It may
>> end up that avahi doesn't meet my needs wrt playing nicely in HA (like
>> what was mentioned before about restarting on a different port).
> 
> HA should work nicely with the proposed scheme (DNS TXT records) and fixed
> ports. Fire up instance one of 'service' on server1:5555, instance two of
> 'service' on server2:5556 and you could have two TXT records for 'service':
> 
> service IN TXT "tcp://server1:5555"
> service IN TXT "tcp://server2:5556"
> 
> 0MQ would get back two records from DNS and try in a round-robin fashion
> until it can connect to one or the other. Straightforward to debug and not
> prone to "magic failures" like I mentioned in my other email.
> 
> The only downside is you need access to your DNS zone.

However, the above still requires using _fixed_ ports rather than 
auto-generating port numbers.

Martin



More information about the zeromq-dev mailing list