package com.yuzhenc.network;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.UnknownHostException;
public class Test01 {
public static void main(String[] args) throws UnknownHostException {
InetAddress ia = InetAddress.getByName("192.168.199.217");
System.out.println(ia);
InetAddress ia2 = InetAddress.getByName("localhost");
System.out.println(ia2);
InetAddress ia3 = InetAddress.getByName("127.0.0.1");
System.out.println(ia3);
InetAddress ia4 = InetAddress.getByName("DESKTOP-UGGVQPG");
System.out.println(ia4);
InetAddress ia5 = InetAddress.getByName("www.baidu.com");
System.out.println(ia5);
System.out.println(ia5.getHostName());
System.out.println(ia5.getHostAddress());
InetSocketAddress isa = new InetSocketAddress("192.168.199.217",8080);
System.out.println(isa);
System.out.println(isa.getHostName());
System.out.println(isa.getPort());
}
}