1、如何通过域名获取ip 透过代理
用站长工具查询即可
http://tool.chinaz.com
2、如何只用C语言,通过域名得到IP地址
#include<stdio.h> //printf
#include<string.h> //memset
#include<stdlib.h> //for exit(0);
#include<sys/socket.h>
#include<errno.h> //For errno - the error number
#include<netdb.h> //hostent
#include<arpa/inet.h>
int hostname_to_ip(char * , char *);
int main(int argc , char *argv[])
{
if(argc <2)
{
printf("Please provide a hostname to resolve");
exit(1);
}
char *hostname = argv[1];
char ip[100];
hostname_to_ip(hostname , ip);
printf("%s resolved to %s" , hostname , ip);
printf("
");
}
/*
Get ip from domain name
*/
int hostname_to_ip(char * hostname , char* ip)
{
struct hostent *he;
struct in_addr **addr_list;
int i;
if ( (he = gethostbyname( hostname ) ) == NULL)
{
// get the host info
herror("gethostbyname");
return 1;
}
addr_list = (struct in_addr **) he->h_addr_list;
for(i = 0; addr_list[i] != NULL; i++)
{
//Return the first one;
strcpy(ip , inet_ntoa(*addr_list[i]) );
return 0;
}
return 1;
}
3、如何通过域名得到IP
最简单的是通过:运行 > cmd > ping 域名 > 回车执行就可以得到该域名现在解析到什么IP了;
第二种可以上http://www.ip138.com 这里查询
4、只用C语言,怎么通过域名得到IP地址
查找的方法(07版为例): 1、在左下方开始键,点击之后出现搜索框 2、在搜索框内输入指令cmd运行 3、进入窗口,按照要求输入指令:nbtstat -a IP,ip地址为你所查询主机的ip地址。 4、这样就可以根据ip泛解析出域名。
5、怎样通过ping命令获取IP查找域名
1、WIN+R键打开运行,输入cmd,进入命令提示符界面。
2、输入命令“ping 域名”,然后回车,在输出信息中,即可找到域名对应IP。下图以www.baidu.com为例。
3、相较于ping命令,通过nslookup命令获取的IP信息会更全面。同样是通过cmd打开命令提示符界面。
4、接下来需要点击输入命令“nslookup 域名”,如图所示,这样就完成了。
6、java怎么通过域名获取ip地址
import java.net.InetAddress;
import java.net.UnknownHostException;
public class TestInetAddress {
InetAddress myIpAddress = null;
InetAddress[] myServer = null;
public static void main(String args[]) {
TestInetAddress address = new TestInetAddress();
System.out.println("Your host IP is: " + address.getLocalhostIP());
String domain = www.jb51.net;
System.out.println("The server domain name is: " + domain);
InetAddress[] array = address.getServerIP(domain);
int count=0;
for(int i=1; i<array.length; i++){
System.out.println("ip "+ i +" "+ address.getServerIP(domain)[i-1]);
count++;
}
System.out.println("IP address total: "+count);
}
/**
* 获得 localhost 的IP地址
* @return
*/
public InetAddress getLocalhostIP() {
try {
myIpAddress = InetAddress.getLocalHost();
} catch (UnknownHostException e) {
e.printStackTrace();
}
return (myIpAddress);
}
/**
* 获得某域名的IP地址
* @param domain 域名
* @return
*/
public InetAddress[] getServerIP(String domain) {
try {
myServer = InetAddress.getAllByName(domain);
} catch (UnknownHostException e) {
e.printStackTrace();
}
return (myServer);
}
}
7、如何通过域名得到其IP
而IP地址则是整个Internet统一的地址标识符,其目的就是屏蔽物理网络细节,使得Internet从逻辑上看是一个整体的网络。在实际的物理传输时,都必须先将IP地址“翻译”为网卡物理地址。y
8、java通过域名获取IP地址
public String getIP(String name){
InetAddress address = null;
try {
address = InetAddress.getByName(name);
} catch (UnknownHostException e) {
// TODO Auto-generated catch block
e.printStackTrace();
System.out.println("获取失败");
}
return address.getHostAddress().toString();
}