FileDocCategorySizeDatePackage
dayTimeServer.javaAPI DocExample717Thu Apr 03 15:24:12 BST 1997None

daytimeServer

public class daytimeServer extends Object

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


       

   ServerSocket theServer;
   Socket theConnection;
   PrintStream p;

   try {
     theServer = new ServerSocket(daytimePort);
     try {
       while (true) {
         theConnection = theServer.accept();
         p = new PrintStream(theConnection.getOutputStream());
         p.println(new Date());        
         theConnection.close();
       }
     }
     catch (IOException e) {
       theServer.close();
       System.err.println(e);
     }

   }  // end try
   catch (IOException e) {
     System.err.println(e);
   }