Java DNS resolveDNS(String dns)

Here you can find the source of resolveDNS(String dns)

Description

resolve DNS

License

BSD License

Declaration

public static String resolveDNS(String dns) throws UnknownHostException 

Method Source Code


//package com.java2s;
//The contents of this file are subject to the "Simplified BSD License" (the "License");

import java.net.InetAddress;
import java.net.UnknownHostException;

public class Main {
    public static String resolveDNS(String dns) throws UnknownHostException {
        InetAddress addr = InetAddress.getByName(dns);
        if (addr == null)
            return null;
        return addr.getHostAddress();

    }//  w w w  .  j  a  v  a2 s. c o  m
}

Related

  1. getDnsDomainName()
  2. getDNSName(String s)