List of utility methods to do Host Address Get
String | getHostName(String address) get Host Name try { int i = address.indexOf(':'); if (i > -1) { address = address.substring(0, i); InetAddress inetAddress = InetAddress.getByName(address); if (inetAddress != null) { String hostname = inetAddress.getHostName(); ... |
String | getHostName(String address) get Host Name try { int i = address.indexOf(':'); if (i > -1) { address = address.substring(0, i); String hostname = hostNameCache.get(address); if (hostname != null && hostname.length() > 0) { return hostname; ... |
String | getHostName(String localAddress) Get the host name of a local address, if available. try { InetAddress addr = InetAddress.getByName(localAddress); return addr.getHostName(); } catch (Exception e) { return "unknown"; |
String | getHostnameOrAddress() Get the hostname or IP address. try { return InetAddress.getLocalHost().getCanonicalHostName(); } catch (UnknownHostException ignored) { try { return getHostAddress(); } catch (Exception e) { return null; |
String | getHostnameOrAddress() get Hostname Or Address try { final InetAddress addr = InetAddress.getLocalHost(); return addr.getHostName(); } catch (UnknownHostException e) { try { Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces(); if (interfaces == null) { return ""; ... |
String | getHostNameOrAddress(String host) get Host Name Or Address String hostname = host; try { InetAddress ia = InetAddress.getByName(host); if (ia != null) hostname = ia.getHostName(); } catch (UnknownHostException uhe) { return hostname; ... |