What is the path leading a "DNS query" to GetHostByName()

phn at icke-reklam.ipsec.nu phn at icke-reklam.ipsec.nu
Thu Jul 29 22:13:58 UTC 2004


valere <tribut.valere at free.fr> wrote:
> 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).

Welcome. This is a long awaited function for a browser.


> 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'd look into getaddrinfo() which partially does this. I'd look into
getaddrinfo() and instead of searching /etc/services send a
SRV-query and work from there.

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

Yes, but the port used will be picked up by the application, hopefully
by getservbyname() 

-- 
Peter Håkanson         
        IPSec  Sverige      ( At Gothenburg Riverside )
           Sorry about my e-mail address, but i'm trying to keep spam out,
	   remove "icke-reklam" if you feel for mailing me. Thanx.



More information about the bind-users mailing list