I have the DNS server IP address and a hostname.
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?
If the DNS for your hostname is not set up correctly, you may receive an email saying something similar to this: Your hostname (srv.example.com) could not be resolved to an IP address. This means that /etc/hosts is not set up correctly, and/or there is no dns entry for srv.example.com.
Hostname Resolution refers to the process through which an assigned hostname is converted or resolved to its mapped IP Address so that networked hosts can communicate with each other. This process can either be achieved locally on the host itself or remotely through a designated host configured to serve that purpose.
Host Name Resolution is the process by which a host determines the IP address of another host given its host name or fully qualified domain name (FQDN) on a TCP/IP network.
Take a look at InetAddress
and the getHostAddress()
method.
InetAddress address = InetAddress.getByName("www.example.com"); System.out.println(address.getHostAddress());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With