package com.lovecoding.day22.tcp01;

import org.junit.Test;

import java.net.InetAddress;
import java.net.UnknownHostException;

public class TestTcp01 {

    @Test
    public void test01() throws UnknownHostException {
        //InetAddress

        InetAddress byName = InetAddress.getByName("www.bdiu.com");
        String hostName = byName.getHostAddress();
        System.out.println(byName);

        InetAddress localhost = InetAddress.getByName("127.0.0.1");
        System.out.println(localhost.getHostAddress());

        //本机ip ipconfig  192.168.18.31
        byte[] adds = {(byte) 192,(byte) 168,18,31};
        InetAddress byAddress = InetAddress.getByAddress(adds);
        System.out.println(byAddress.getHostAddress());

    }

}
