gpt4 book ai didi

java - 查询 DNS 服务器时的域名

转载 作者:行者123 更新时间:2023-11-29 06:17:08 26 4
gpt4 key购买 nike

当向 DNS 服务器查询 IP 地址时,以下哪一项是有效的域名(或主机名)?我想用 Java 编写一个程序来查询 DNS 服务器以获取给定主机的 IP 地址。

www.google.com
OR
google.com

最佳答案

为什么不两者都试试呢?他们可能有相同的一组 resource records ,它们可能不同,或者一个可能是另一个的别名。实际上它们是不同的:

nickf@gloin:~$ host google.com
google.com has address 72.14.204.99
google.com has address 72.14.204.104
google.com has address 72.14.204.103
google.com has address 72.14.204.147
google.com mail is handled by 100 google.com.s9a1.psmtp.com.
google.com mail is handled by 300 google.com.s9b1.psmtp.com.
google.com mail is handled by 400 google.com.s9b2.psmtp.com.
google.com mail is handled by 200 google.com.s9a2.psmtp.com.

nickf@gloin:~$ host www.google.com
www.google.com is an alias for www.l.google.com.
www.l.google.com has address 72.14.204.147
www.l.google.com has address 72.14.204.103
www.l.google.com has address 72.14.204.99
www.l.google.com has address 72.14.204.104

关于java - 查询 DNS 服务器时的域名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4651513/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com