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

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

public class DayClient2{
    // Class named constant
    public static final int DAYTIME_PORT = 1313;

    // Instance variables
    String host;
    Socket s;

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

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

    public void go() throws IOException{
        s = new Socket( host,DAYTIME_PORT );
        BufferedReader in = new BufferedReader(
                            new InputStreamReader(s.getInputStream() ) );
        System.out.println( in.readLine() );
        in.close();
        s.close();
    }
}
