Java Utililty Methods DNS

List of utility methods to do DNS

Description

The list of methods to do DNS are organized into topic(s).

Method

StringgetDnsDomainName()
Get the DNS domain name (eg: example.org).
return getDnsDomainName(InetAddress.getLocalHost().getCanonicalHostName());
StringgetDNSName(String s)
get DNS Name
if (!enableDNS)
    return s;
String s1;
try {
    InetAddress inetaddress = InetAddress.getByName(s);
    s1 = inetaddress.getHostName().trim();
} catch (UnknownHostException unknownhostexception) {
    s1 = s;
...
StringresolveDNS(String dns)
resolve DNS
InetAddress addr = InetAddress.getByName(dns);
if (addr == null)
    return null;
return addr.getHostAddress();