解析主机名的IP地址 [英] Resolving ip-address of a hostname
本文介绍了解析主机名的IP地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有DNS服务器的IP地址和主机名。
I have the DNS server IP address and a hostname.
使用Java,如何找到该DNS服务器使用的DNS返回的主机名的IP地址IP地址和主机名?
Using Java, how can I find the IP address of the hostname as returned by that DNS server using the IP address and the hostname?
推荐答案
看看 InetAddress
和 getHostAddress()
方法。
Take a look at InetAddress
and the getHostAddress()
method.
InetAddress address = InetAddress.getByName("www.example.com");
System.out.println(address.getHostAddress());
这篇关于解析主机名的IP地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文