FileDocCategorySizeDatePackage
GetTime.javaAPI DocExample1029Mon Oct 16 19:44:04 BST 2000None

GetTime

public class GetTime extends Object

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)

  if( args.length != 1 )

      {  System.out.println( "Useage: java GetTime host" );

         System.exit(0);

      }

      String host = args[0];

      

      Socket s = null;

      try

      {  s = new Socket( host, 13 );

         BufferedReader r = new BufferedReader(

                              new InputStreamReader(

                                s.getInputStream() ) );

         boolean done = false;

         while( !done )

         {  String st = r.readLine();

            if( st != null )

            {  System.out.println( st );  

            }

            else

            {  done = true;

            }

         }

      }

      catch( IOException e )

      {  e.printStackTrace();

      }