private String getIpAddr() {
String IP = null;
StringBuilder IPStringBuilder = new StringBuilder();
try {
Enumeration<NetworkInterface> networkInterfaceEnumeration = NetworkInterface.getNetworkInterfaces();
while (networkInterfaceEnumeration.hasMoreElements()) {
NetworkInterface networkInterface = networkInterfaceEnumeration.nextElement();
Enumeration<InetAddress> inetAddressEnumeration = networkInterface.getInetAddresses();
while (inetAddressEnumeration.hasMoreElements()) {
InetAddress inetAddress = inetAddressEnumeration.nextElement();
if (!inetAddress.isLoopbackAddress()&&!inetAddress.isLinkLocalAddress()&&inetAddress.isSiteLocalAddress()) {
IPStringBuilder.append(inetAddress.getHostAddress().toString()+"\n");
}
}
}
}catch (SocketException ex) {
}
IP = IPStringBuilder.toString();
return IP;
}