Boost logo

Boost Users :

Subject: Re: [Boost-users] asio tcp::resolver, service resolution
From: Chris Cleeland (chris.cleeland_at_[hidden])
Date: 2011-08-26 10:58:06


On Thu, Aug 25, 2011 at 10:49 PM, Lloyd <lloydkl.tech_at_[hidden]> wrote:
> Why the DNS protocol can't be extended to resolve services also? So
> many people must have faced this issue, and why didn't thay think in
> this way? Is there any technical barrier?

only well-known service names can be reliably resolved via name; DNS
doesn't address this because DNS was conceived to deal with domain
name-to-IP address resolution.

As someone else mentioned, there is a SRV record type in DNS that was
intended to function similar to what you're after, but I do not
believe that the value of the SRV records were standardize or that
they were even intended to be only port names. If memory recalls
correctly, the idea was to be able to search for a service within a
subdomain.

SRV never got much widespread use for whatever reason, and its
proposed functionality may be largely subsumed and overshadowed by the
much better specified and much more widely-deployed zeroconf protocol,
two implementations of which are Bonjour (from Apple) and Avahi (on
linux).

The answer to your original issue of how to get the port number for
your own service is to simply embed the default port number in your
code, allow the user to specify a different port from a command
line/config file, and allow specification of the port by name or by
number. That's pretty much how it's been done for the last 20+ years.

-cj


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net