// Purpose.  Socket client demo  [source: Hortsmann98, p137]

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

public class SocketClient {
   public static void main( String[] args ) {
      try {
         Socket         s  = new Socket( "time-A.timefreq.bldrdoc.gov", 13 );
         BufferedReader in = new BufferedReader( 
                                new InputStreamReader( s.getInputStream() ) );
         while (true) {
            String str = in.readLine();
            if (str == null) break;
            System.out.println( str );
         }
         in.close();

      } catch( IOException e ) {
         e.printStackTrace();
      }
   }
}

// C:> java SocketClient
// 51125 98-11-08 08:05:34 00 0 0 422.3 UTC(NIST) *
// C:> date
// Current date is Sun 11-08-1998
// C:> time
// Current time is  2:05:59.64a
