/*
 * Example from p. 501 of Java 1.1 Developer's Handbook.
 */

import java.net.*;
import java.io.*;

public class DayClient1{
    // Class named constant
    public static final int DAYTIME_PORT = 13;

    // Instance variables
    String host;
    Socket s;

    public static void main( String arg[] ) throws IOException{
        DayClient1 that = new DayClient1( arg[0] );
        that.go();
    }

    public DayClient1( String host ){
        this.host = host;
    }

    public void go() throws IOException{
        s = new Socket( host,DAYTIME_PORT );

        // Get an input stream for this socket and buffer it for eff.
        BufferedReader in = new BufferedReader(
                            new InputStreamReader(s.getInputStream() ) );

        //Read & print a single line from the input stream provided by server
        System.out.println( in.readLine() );

        in.close();
        s.close();
    }
}
