import java.io.*; import java.net.*; import java.util.Calendar; public class RealTimeServer extends Thread { Socket client; RealTimeServer( Socket cli ) { client = cli; } public void run() { try { BufferedReader is = new BufferedReader( new InputStreamReader( client.getInputStream() ) ); PrintWriter os = new PrintWriter( client.getOutputStream(), true ); Calendar now = Calendar.getInstance(); os.println( "" ); os.println( "00000 " + now.get( Calendar.YEAR ) + "-" + now.get( Calendar.MONTH ) + "-" + now.get( Calendar.DAY_OF_MONTH ) + " " + now.get( Calendar.HOUR_OF_DAY ) + ":" + now.get( Calendar.MINUTE ) + ":" + now.get( Calendar.SECOND ) + " 00 0 0 000.0 EST(SARH) *" ); is.close(); } catch ( IOException e ) { System.out.println( e ); } } public static void main( String args[] ) { try { ServerSocket srv = new ServerSocket( 2222 ); Socket sock; while ( (sock = srv.accept()) != null ) { System.out.println( "spawn..." ); new RealTimeServer( sock ).start(); } } catch ( IOException e ) { System.out.println( e ); } } }