Path leading a "DNS query" to GetHostByName

G

Guest

Guest
Archived from groups: microsoft.public.win2000.dns (More info?)

As a newcomer in Dns I would need some explanations to make and send a
DNS Srv query. My goal is to get the IP_address of a Http server
furnished by/in the RR (from the DNS server).


The way one builds a simple DNS query is very transparent (to me).
Meaning I use 'gethostbyname' standard API:


struct hostent * remoteHost;

myHost = gethostbyname("OneGivenKnownHttpDomainName");
IP_Http_Server = myHost->h_addr;
// Here my goal is reached: IP_Http_Server has been identified


I "guess" that the standard DNS query has been (automatically) built
by "gethostbyname" like this:

QUERY:
[QNAME="OneGivenKnownHttpDomainName", QCLASS=IN" ...]

and transmitted (how ? Via socket mechanism ?...) to the targeted DNS
server. Am I wrong ? I see no clear binding between my supposed
previous "DNS query" form and "gethostbyname" action.


Things are getting much more mysterious when intending to proceed with
a DNS Srv query. I would like to build and send a DNS Srv query this
way:

QUERY:
[QNAME="SpecificService._tcp_.OneGivenDomainName", QCLASS="IN",
QTYPE="SRV"]

But how to transmit such a query to the targeted DNS server ? Still
Using "gethostbyname" ? Or Is there another API that would be
dedicated to that new kind of specific DNS query ? Which one ? Sorry
for so much naivety.
 
G

Guest

Guest
Archived from groups: microsoft.public.win2000.dns (More info?)

GetHostByName will only query for "A" records. The Win32 DnsQuery api will
allow others (not sure about srv, but I think so.)

--
William Stacey, MVP

"valere" <tribut.valere@free.fr> wrote in message
news:445182dd.0407291045.12ed44cc@posting.google.com...
> As a newcomer in Dns I would need some explanations to make and send a
> DNS Srv query. My goal is to get the IP_address of a Http server
> furnished by/in the RR (from the DNS server).
>
>
> The way one builds a simple DNS query is very transparent (to me).
> Meaning I use 'gethostbyname' standard API:
>
>
> struct hostent * remoteHost;
>
> myHost = gethostbyname("OneGivenKnownHttpDomainName");
> IP_Http_Server = myHost->h_addr;
> // Here my goal is reached: IP_Http_Server has been identified
>
>
> I "guess" that the standard DNS query has been (automatically) built
> by "gethostbyname" like this:
>
> QUERY:
> [QNAME="OneGivenKnownHttpDomainName", QCLASS=IN" ...]
>
> and transmitted (how ? Via socket mechanism ?...) to the targeted DNS
> server. Am I wrong ? I see no clear binding between my supposed
> previous "DNS query" form and "gethostbyname" action.
>
>
> Things are getting much more mysterious when intending to proceed with
> a DNS Srv query. I would like to build and send a DNS Srv query this
> way:
>
> QUERY:
> [QNAME="SpecificService._tcp_.OneGivenDomainName", QCLASS="IN",
> QTYPE="SRV"]
>
> But how to transmit such a query to the targeted DNS server ? Still
> Using "gethostbyname" ? Or Is there another API that would be
> dedicated to that new kind of specific DNS query ? Which one ? Sorry
> for so much naivety.