FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Reverse dns lookup
Posts: 172
Joined: Fri Oct 07, 2005 01:29 PM
Reverse dns lookup
Posted: Wed Sep 13, 2006 05:43 AM

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

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Reverse dns lookup
Posted: Wed Sep 13, 2006 05:19 PM
Alex,

Try this:

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


James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 172
Joined: Fri Oct 07, 2005 01:29 PM
Reverse dns lookup
Posted: Thu Sep 14, 2006 04:13 AM

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

Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Reverse dns lookup
Posted: Thu Sep 14, 2006 07:29 AM
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
Posts: 840
Joined: Thu Oct 13, 2005 07:05 PM
Reverse dns lookup
Posted: Thu Sep 14, 2006 04:07 PM

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.
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Reverse dns lookup
Posted: Thu Sep 14, 2006 04:44 PM

Sorry, I don't know. I never used that API.

EMG

Posts: 172
Joined: Fri Oct 07, 2005 01:29 PM
Reverse dns lookup
Posted: Thu Sep 14, 2006 05:20 PM
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

Continue the discussion