List of utility methods to do IP Address Get
String | getLocalIp() get Local Ip String ret = null; try { Enumeration<NetworkInterface> nets = NetworkInterface.getNetworkInterfaces(); while (nets.hasMoreElements()) { NetworkInterface net = nets.nextElement(); if (net.isLoopback() || net.isVirtual() || net.getName().startsWith("vmnet") || net.getName().startsWith("docker")) { continue; ... |
String | getLocalIp() Returns the local IP. return chooseAddress().getHostAddress();
|
String | getLocalIP() get Local IP if (localIp != null) { return localIp; Enumeration<?> e1 = (Enumeration<?>) NetworkInterface.getNetworkInterfaces(); while (e1.hasMoreElements()) { NetworkInterface ni = (NetworkInterface) e1.nextElement(); if (!isUp(ni)) { continue; ... |
String | getLocalIP() get Local IP String localip = ""; InetAddress inetaddress = InetAddress.getLocalHost(); localip = inetaddress.getHostAddress(); if ("127.0.0.1".equals(localip) || "localhost".equals(localip) || localip.indexOf("local") != -1) { Enumeration<NetworkInterface> allnetinterface = NetworkInterface.getNetworkInterfaces(); while (allnetinterface.hasMoreElements()) { NetworkInterface net = allnetinterface.nextElement(); Enumeration<InetAddress> ipenum = net.getInetAddresses(); ... |
int[] | getLocalIP() get Local IP try { InetAddress addr = InetAddress.getLocalHost(); byte[] ip = addr.getAddress(); if (ip == null || ip.length != 4) { return null; int[] ret = new int[4]; for (int cnt = 0; cnt < 4; cnt++) { ... |
String | getLocalIP() get Local IP return getLocalIP(EXCLUDE_IP);
|
String | getLocalIp() get Local Ip try { Pattern pattern = Pattern.compile("(172|10)\\.[0-9]+\\.[0-9]+\\.[0-9]+"); Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces(); while (interfaces.hasMoreElements()) { NetworkInterface ni = interfaces.nextElement(); Enumeration<InetAddress> en = ni.getInetAddresses(); while (en.hasMoreElements()) { InetAddress addr = en.nextElement(); ... |
String | getLocalIp() get Local Ip return getLocalIp("*>10>172>192>127"); |
InetAddress | getLocalIP() Get a local IP for remote access. Enumeration<NetworkInterface> netInterfaces = NetworkInterface.getNetworkInterfaces(); InetAddress ip = null; InetAddress localip = null; while (netInterfaces.hasMoreElements()) { NetworkInterface netIntf = netInterfaces.nextElement(); Enumeration<InetAddress> address = netIntf.getInetAddresses(); while (address.hasMoreElements()) { ip = address.nextElement(); ... |
String | getLocalIp() Get local IP String ip = InetAddress.getLocalHost().getHostAddress();
return ip;
|