|
Boost Users : |
Subject: Re: [Boost-users] asio tcp::resolver, service resolution
From: Lloyd (lloydkl.tech_at_[hidden])
Date: 2011-08-25 23:49:52
So the port resolution is not as easy as domain name resolution
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?
Thanks a lot,
Lloyd
On Thu, Aug 25, 2011 at 9:22 PM, Andrew Holden
<aholden_at_[hidden]> wrote:
> On Thursday, August 25, 2011 11:21 AM, Lloyd wrote:
>> In documentation I saw that using tcp::resolver::query constructor it
> is
>> possible to resolve domain.name as well as service name, as shown in
> the
>> following code fragment.
>>
>> boost::asio::io_service ios;
>> boost::asio::ip::tcp::resolver resolver(ios);
>> boost::asio::ip::tcp::resolver::query
> query("mydomain.com","myservice");
>>
>> Here 'myservice' is not a well known service (port number).
>>
>> For resolving 'myservice' where should I add the port number? in my
> domain
>> name server's (BIND) /etc/services file or in my local systems
> services file?
>>
>> Or is it 'really' possible to resolve a service name?
>
> The easiest method is to include the service port number as a string.
> For example, if you're listening on port 12345, your query would be:
>
> boost::asio::ip::tcp::resolver::query query("mydomain.com","12345");
>
> If you hope your program will be widely distributed, then it might to
> worth your while to register your port name with IANA and wait for your
> and your clients' OS vender to update the "services" file (/etc/services
> or c:\windows\system32\drivers\etc\sevices).
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
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