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);
}