import java.io.*;
import java.net.*;
import java.util.Scanner;

public class SocketTest {
    public static void main(String[] args) throws IOException {
        // NIST 시간 서버 연결 (포트 13)
        try (Socket s = new Socket("time-c.nist.gov", 13)) {
            InputStream inStream = s.getInputStream();
            Scanner in = new Scanner(inStream);
            
            while (in.hasNextLine()) {
                String line = in.nextLine();
                System.out.println(line);
            }
        }
    }
}
