728x90
public static String getHostAddress(){
String result = null;
try {
result = InetAddress.getLocalHost().getHostAddress();
} catch (UnknownHostException e) {
result = "";
}
return result;
}
public static String getHostName(){
String result = null;
try {
result = InetAddress.getLocalHost().getHostName();
} catch (UnknownHostException e) {
result = "";
}
return result;
}
728x90