org.apache.commons.net.time
Class TimeTestSimpleServer

java.lang.Object
  extended by org.apache.commons.net.time.TimeTestSimpleServer
All Implemented Interfaces:
Runnable

public class TimeTestSimpleServer
extends Object
implements Runnable

The TimetSimpleServer class is a simple TCP implementation of a server for the Time Protocol described in RFC 868.

Listens for TCP socket connections on the time protocol port and writes the local time to socket outputStream as 32-bit integer of seconds since midnight on 1 January 1900 GMT. See the spec for details.

Note this is for debugging purposes only and not meant to be run as a realiable time service.

Version:
$Revision: 658518 $ $Date: 2008-05-21 02:04:30 +0100 (Wed, 21 May 2008) $
Author:
Jason Mathews, MITRE Corporation

Field Summary
static int DEFAULT_PORT
          The default time port.
static long SECONDS_1900_TO_1970
          baseline time 1900-01-01T00:00:00 UTC
 
Constructor Summary
TimeTestSimpleServer()
          Default constructor for TimetSimpleServer.
TimeTestSimpleServer(int port)
          Constructor for TimetSimpleServer given a specific port.
 
Method Summary
 void connect()
           
 int getPort()
           
 boolean isRunning()
           
static void main(String[] args)
           
 void run()
           
 void start()
          Start time service and provide time to client connections.
 void stop()
          Close server socket.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SECONDS_1900_TO_1970

public static final long SECONDS_1900_TO_1970
baseline time 1900-01-01T00:00:00 UTC

See Also:
Constant Field Values

DEFAULT_PORT

public static final int DEFAULT_PORT
The default time port. It is set to 37 according to RFC 868.

See Also:
Constant Field Values
Constructor Detail

TimeTestSimpleServer

public TimeTestSimpleServer()
Default constructor for TimetSimpleServer. Initializes port to defaul time port.


TimeTestSimpleServer

public TimeTestSimpleServer(int port)
Constructor for TimetSimpleServer given a specific port.

Method Detail

connect

public void connect()
             throws IOException
Throws:
IOException

getPort

public int getPort()

isRunning

public boolean isRunning()

start

public void start()
           throws IOException
Start time service and provide time to client connections.

Throws:
IOException

run

public void run()
Specified by:
run in interface Runnable

stop

public void stop()
Close server socket.


main

public static void main(String[] args)


Copyright © 1997-2009 Apache Software Foundation. All Rights Reserved.