How can I convert an IP address to a hostname like something.sip.bct.bell.net or something like that? is there a way to do it with c++? thanks.
Five answers:
hw
2008-07-24 11:40:12 UTC
What you want is done by something called a reverse DNS name lookup. Look at this website: http://remote.12dt.com/
You can do it in C++ with some amount of programming. You have to write code to communicate to DNS servers and request a reverse lookup query. You can take a look at http://en.wikipedia.org/wiki/Domain_Name_System for more information
Anand N
2008-07-24 18:42:22 UTC
Hi
I assume that you will have an ip address and you will want to get the host name from it ,
like you will give 64.233.167.99 and you want the result as
www.google.com
import java.net.*;
public class Main {
public static void main(String[] args) {
try {
String IP = "64.233.167.99";
String hostname =
//use inetaddr.getbyname.gethostname
InetAddress.getByName(IP).getHostName();
System.out.println("hostname = " + hostname);
}
catch(Exception e) {
System.out.prinln("exception ");
}
}
}
Shane
2008-07-24 18:25:05 UTC
you can go to a domain registrar such as http://www.godaddy.com and buy a domain for about $10 a year. Then you have rights to the domain and you can forward it to the IP address.
anonymous
2008-07-24 18:23:23 UTC
To do this you need to register the name with a domain registrar. You cn not just choose a name and use it.
anonymous
2008-07-24 18:22:20 UTC
localhost
127.0.0.1
ⓘ
This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.