InetAddress 获取 IP 信息
InetAddress.getByName() 获取 InetAddress 对象
// 主机名
InetAddress address = InetAddress.getByName('myhost');
// 或 ip 地址
InetAddress address = InetAddress.getByName('192.168.1.100');
获取主机名
String name = address.getHostName();
system.out.println("主机名:" + name);
获取主机 ip
String ip = address.getHostAddress();
system.out.println("主机 ip:" + ip);