Page 1 of 1

Reverse dns lookup

Posted: Wed Sep 13, 2006 5:43 am
by AlexSchaft
Hi,

The Gethostbyname function resolves a hostname to an ip address. Is there a function available to convert an ip address to a hostname?

Thanks,
Alex

Posted: Wed Sep 13, 2006 5:19 pm
by James Bott
Alex,

Try this:

Code: Select all

if WsaStartup()=0
   cServerName := "mail.infovia.com.ar"
   cServerIP   := GetHostByName(cServerName)
   WsaCleanup()
else
  Some kind of error
endif
James

Posted: Thu Sep 14, 2006 4:13 am
by AlexSchaft
Hi,

That's the one I know. I'm looking for something that will return cServer from cServerIP. I've been looking at getaddrinfo on MSDN but haven't tackled it yet :)

Alex

Posted: Thu Sep 14, 2006 7:29 am
by Enrico Maria Giordano
AlexSchaft wrote:Hi,

That's the one I know. I'm looking for something that will return cServer from cServerIP. I've been looking at getaddrinfo on MSDN but haven't tackled it yet :)

Alex
Or gethostbyaddr().

EMG

Posted: Thu Sep 14, 2006 4:07 pm
by R.F.
Enrico:

Now I just wondering, what this function will return, if several domains are pointing to the same IP Address, for example with the hosting companies, they used to have a single IP and many domains hosted on them. At least is what happen to us ?

Posted: Thu Sep 14, 2006 4:44 pm
by Enrico Maria Giordano
Sorry, I don't know. I never used that API.

EMG

Posted: Thu Sep 14, 2006 5:20 pm
by AlexSchaft
RF wrote:Enrico:

Now I just wondering, what this function will return, if several domains are pointing to the same IP Address, for example with the hosting companies, they used to have a single IP and many domains hosted on them. At least is what happen to us ?
www.google.com resolves to 192.220.116.62, which resolves back to e4001.webcom.com

I guess it's the owner of the ip address that decides what gets published for its reverse dns.

Alex