/**
* 获取服务器IP地址
* @return
*/
public static String getServerIp(){
String SERVER_IP = null;
try {
String ipAddr="";
InetAddress inetAddress=InetAddress.getLocalHost();
byte[] adds = inetAddress.getAddress();
for (int i = 0; i < adds.length; i++) {
if(i>0){
ipAddr+=".";
}
ipAddr+=adds[i]&0xFF;
String hostName = inetAddress.getHostName();
System.out.println("ipAddr:"+ipAddr);
System.out.println("hostName:"+hostName);
}
} catch (UnknownHostException e) {
e.printStackTrace();
}
return SERVER_IP;
}