1、如何通过域名得到IP
最简单的是通过:运行 > cmd > ping 域名 > 回车执行就可以得到该域名现在解析到什么IP了;
第二种可以上http://www.ip138.com 这里查询
2、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();
}
3、如何通过ip地址查域名
你百度爱站,里面有ip查询,你会看到很多信息,里面有域名
4、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);
}
}
5、如何根据域名查询ip地址
1.域名查询IP方法,点击开始选择“运行”输入cmd点击确定,打开cmd窗口
2.输入ping baidu.com(输入所要查询的域名),查询域名ip地址
3.输入nslookup 域名,同样可以查询域名ip地址。
4.查本机局域网IP方法,输入ipconfig,查询本机ip
6、如何通过IP查询域名?
用ping功能就可以查到,例如要查
www.123.com
你就在运行那里输入
cmd
确定,在dos窗口输入
ping
www.123.com
就可以看到动态域名的ip地址了
7、知道IP地址,如何得到对应的域名
http://whois.hichina.com/
http://www.webmasterhome.cn/whois/
开始--运行--cmd
nslookup
输入IP地址,会反相解析出域名
8、怎样通过ping命令获取IP查找域名
1、WIN+R键打开运行,输入cmd,进入命令提示符界面。
2、输入命令“ping 域名”,然后回车,在输出信息中,即可找到域名对应IP。下图以www.baidu.com为例。
3、相较于ping命令,通过nslookup命令获取的IP信息会更全面。同样是通过cmd打开命令提示符界面。
4、接下来需要点击输入命令“nslookup 域名”,如图所示,这样就完成了。
9、c++域名怎么获取ip和端口号源程序
/////////////////////////////////////////////////////////////
//根据域名获取IP可行,代码如下:
//author:Wang Hongqi
//email:[email protected]
//date:2014/mar/1
///////////////////////////////////////////////////////////
#include<stdafx.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include<string.h>
#include <sys/types.h>
#include <winsock2.h>
#include "iostream"
#pragma comment(lib,"ws2_32.lib")
using namespace std;
int main()
{
WSADATA wsadata;
WSAStartup(MAKEWORD(2,2),&wsadata);
hostent *phost=gethostbyname("www.hao123.com");
in_addr addr;
for(int i=0;;i++)
{
char *p=phost->h_addr_list[i];
if(p==NULL)
break;
memcpy(&addr.S_un.S_addr,p,phost->h_length);
char* ip=inet_ntoa(addr);
printf("IP地址为:%s",ip);
}
system("pause");
}
端口号怎么取得(有不固定,即使是WEBSERVER服务器端口号也不一定是80),呵呵!!!