获取 Yahoo IP 地址不起作用
我使用 java 中的 InetAddress 类获取雅虎 IP 地址。当网络浏览器的 URL 中给出时,yahoo.com IP 地址的结果不起作用。
InetAddress[] all = InetAddress.getAllByName("www.yahoo.com");
for (int i=0; i<all.length; i++)
{
System.out.println(" address = " + all[i]);
}
它显示的结果为, 地址 = www.yahoo.com/67.195.160.76 地址 = www.yahoo.com/69.147.125.65
当我将这些 IP 输入到浏览器的 URL 中时(即 http://67.195.160.76 ),浏览器显示“未找到所需的 URL”。
那有什么问题呢。 java程序产生的结果是错误的吗?
I get the Yahoo IP address using InetAddress class in java. The result of yahoo.com IP address is not working while given in URL of web browsers.
InetAddress[] all = InetAddress.getAllByName("www.yahoo.com");
for (int i=0; i<all.length; i++)
{
System.out.println(" address = " + all[i]);
}
It shows result as,
address = www.yahoo.com/67.195.160.76
address = www.yahoo.com/69.147.125.65
When i entered those ip into browser's url(ie., http://67.195.160.76), the browser shows "Requisted URL not found".
What's the problem in that. Is the result produced by the java program wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
IP地址没有错。但是,Web 服务器会准确地获悉您在 URL 栏中输入的内容,并且它可以根据您使用的主机名选择向您显示不同的内容。在这种情况下,当您请求主机
67.195.160.76
时,Yahoo Web 服务器(位于该地址)选择不向您显示任何内容。此信息在
Host
中传递HTTP 标头。该标头是虚拟主机或“vhosts”工作方式的基础。The IP address is not wrong. However, the web server is told exactly what you type into the URL bar, and it can choose to show you different content based on the hostname that you use. In this case, a Yahoo web server (which is at that address) is choosing not to show you anything when you request the host
67.195.160.76
.This information is passed in the
Host
HTTP header. This header is the basis of how virtual hosts, or "vhosts", work.