how to get hostname with IP without logging into the host
+3
A:
- For Win32,
getnameinfo()
. - For POSIX,
gethostbyaddr()
.
Making a portable wrapper is left as an exercise. :)
unwind
2009-04-01 08:21:18
In Java, there's InetAddress.getHostName(). Does that count? :)
Matthew Flaschen
2009-04-28 01:55:18
+1
A:
If you're not using it in code (and you're not, according to an answer you posted, which should have really been an edit to your question :-), it's not a programming question.
But the answer is to use nslookup.
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\Documents and Settings\Administrator>nslookup www.company.com
Server: bhadns01.company.com
Address: 9.190.234.35
Non-authoritative answer:
Name: www-int.company.com.cs186.net
Address: 129.42.58.216
Aliases: www.company.com
C:\Documents and Settings\Administrator>nslookup 129.42.58.216
Server: bhadns01.company.com
Address: 9.190.234.35
Non-authoritative answer:
Name: www-int.company.com.cs186.net
Address: 129.42.58.216
Aliases: www.company.com
C:\Documents and Settings\Administrator>
paxdiablo
2009-04-01 08:29:57