private static boolean testIP(String name){
try {
InetAddress inetaddr=InetAddress.getByName(name);
} catch (UnknownHostException e) {
return false;
}
return true;
}
实现了IP地址的合法性判断,不过效率有点低!
private static boolean testIP(String name){
try {
InetAddress inetaddr=InetAddress.getByName(name);
} catch (UnknownHostException e) {
return false;
}
return true;
}
实现了IP地址的合法性判断,不过效率有点低!