/**
* 获取Linux下的IP地址
*
* @return IP地址
* @throws SocketException
*/
private static String getLinuxLocalIp() throws SocketException {
String ip = "";
try {
for (Enumeration<NetworkInterface> en = (); ();) {
NetworkInterface intf = ();
String name = ();
if (!("docker") && !("lo")) {
for (Enumeration<InetAddress> enumIpAddr = (); ();) {
InetAddress inetAddress = ();
if (!()) {
String ipaddress = ().toString();
if (!("::") && !("0:0:") && !("fe80")) {
ip = ipaddress;
(ipaddress);
}
}
}
}
}
} catch (SocketException ex) {
("获取ip地址异常");
ip = "127.0.0.1";
();
}
("IP:"+ip);
return ip;
}