public static void main(String[] args) throws UnknownHostException {
// InetAddress address = InetAddress.getByName("192.168.1.121");
InetAddress address = InetAddress.getByName("myPc");
String hostAddress = address.getHostAddress();
String hostName = address.getHostName();
System.out.println(hostAddress);
System.out.println(hostName);
}
网路编程概述
于 2022-05-04 19:17:21 首次发布