public static String getIpByHost(String hostName) {
		try {
			return InetAddress.getByName(hostName).getHostAddress();
		} catch (UnknownHostException e) {
			return hostName;
		}
	}
public static String getIpByHost ( String hostName ) { try { return InetAddress . getByName ( hostName ) . getHostAddress ( ) ; } catch ( UnknownHostException e ) { return hostName ; } }
通过域名得到IP

@param hostName HOST
@return ip address or hostName if UnknownHostException