[zeromq-dev] automatically choosing a free TCP port

Martin Sustrik sustrik at 250bpm.com
Mon Mar 15 13:39:39 CET 2010


David,

>> I am not familiar with avahi details. What's the use case and how would you
>> except the whole thing to work?
> 
> The basic use-case would be to announce a service(s) to a network. eg,
> you have an application that consumes something (using zmq_sub or
> zmq_rep) and you don't want to have to tell all the clients how to
> connect to it (eg, the IP address and port number that your zmq based
> app is listening on - the address argument for zmq_bind). You can use
> avahi to tell everything on the network what IP and port your
> application is listening on. The publishing application(s) can then
> feed your consumer because they learned the address details.
> 
> Its basically makes configuration a bit more flexible because you
> don't have to care where your app runs - as long as everything that
> needs to find it can find it you're happy. Avahi will make sure that
> your producers can find your consumers (provided that you've hooked
> them up correctly).

Fair enough! We've been discussing this scenario, thinking more of DNS 
as a provider of routing info...

However, even in your scenario fixed port numbers would work well. It'll 
take a bit of manual setup, however, that way you'll avoid nasty 
problems when service goes down, is restarted and assigned a different 
port number.

Martin



More information about the zeromq-dev mailing list