Java IP Address Get getHostIPByHostName(String host)

Here you can find the source of getHostIPByHostName(String host)

Description

get Host IP By Host Name

License

Apache License

Declaration

public static String getHostIPByHostName(String host) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.net.InetAddress;

import java.net.UnknownHostException;

public class Main {

    public static String getHostIPByHostName(String host) {
        InetAddress inetAddress;//from w ww. j  a  v  a  2s  .  com
        try {
            inetAddress = InetAddress.getByName(host);
            return inetAddress.getHostAddress();
        } catch (UnknownHostException e) {
            e.printStackTrace();
        }
        return null;
    }
}

Related

  1. getHostIp()
  2. getHostIP()
  3. getHostIP()
  4. getHostIP()
  5. getHostIpAddress()
  6. getInetIps()
  7. getIniFileInputStreamEclipse()
  8. getInputStreamFromZipFile( String zipFilePath, String resourcePath)
  9. getInterfaceAddress(final String ifaceName, final boolean ipV4)