package inetaddr;

import java.io.*;
import java.net.*;

public class InetAddr {
    public static void main(String[] args) throws IOException {
        BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
        System.err.print("Nazwa hosta: ");
        String host = stdin.readLine().trim();
        try {
            //InetAddress address = InetAddress.getByName(host);
            //System.out.println(address);
            //InetAddress[] addresses = InetAddress.getAllByName(host);
            //for (InetAddress address: addresses) System.out.println(address);
            InetAddress address = InetAddress.getByName(host);
            System.out.println(address.getHostAddress());
            System.out.println(address.getHostName());
            System.out.println(address.getCanonicalHostName());
        }
        catch (UnknownHostException ex) {
            System.out.println("Nie można zlokalizować hosta " + host + "!");
        }
    }
}
