Reverse dns lookup

Post Reply
User avatar
AlexSchaft
Posts: 172
Joined: Fri Oct 07, 2005 1:29 pm
Location: Edenvale, Gauteng, South Africa

Reverse dns lookup

Post 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
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post 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
User avatar
AlexSchaft
Posts: 172
Joined: Fri Oct 07, 2005 1:29 pm
Location: Edenvale, Gauteng, South Africa

Post 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
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Post 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
R.F.
Posts: 840
Joined: Thu Oct 13, 2005 7:05 pm

Post 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 ?
Saludos
R.F.
User avatar
AlexSchaft
Posts: 172
Joined: Fri Oct 07, 2005 1:29 pm
Location: Edenvale, Gauteng, South Africa

Post 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
Post Reply