quamj.qps.util.ntp
Class NtpConnection

java.lang.Object
  |
  +--quamj.qps.util.ntp.NtpConnection

public class NtpConnection
extends java.lang.Object


Field Summary
static int defaultNtpPort
           
 
Constructor Summary
NtpConnection(java.net.InetAddress iaddr)
           
NtpConnection(java.net.InetAddress iaddr, int iport)
           
 
Method Summary
 void close()
           
 void finalize()
           
 NtpInfo getInfo()
           
 java.util.Date getTime()
          Get the time from the server.
 int getTimeout()
           
 java.util.Vector getTrace()
          Traces a server to the primary server.
 void receive(NtpDatagramPacket ntpDatagramPacket)
           
 void send(NtpDatagramPacket ntpDatagramPacket)
           
 void setTimeout(int timeout)
           
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaultNtpPort

public static final int defaultNtpPort
See Also:
Constant Field Values
Constructor Detail

NtpConnection

public NtpConnection(java.net.InetAddress iaddr,
                     int iport)
              throws java.net.SocketException

NtpConnection

public NtpConnection(java.net.InetAddress iaddr)
              throws java.net.SocketException
Method Detail

getTimeout

public int getTimeout()

setTimeout

public void setTimeout(int timeout)
                throws java.net.SocketException
java.net.SocketException

send

public void send(NtpDatagramPacket ntpDatagramPacket)
          throws java.io.IOException
java.io.IOException

receive

public void receive(NtpDatagramPacket ntpDatagramPacket)
             throws java.io.IOException
java.io.IOException

getInfo

public NtpInfo getInfo()
                throws java.io.IOException
java.io.IOException

getTrace

public java.util.Vector getTrace()
Traces a server to the primary server.

Returns:
Vector containing the NtpInfo objects associated with the servers on the path to the primary server. Sometimes only a partial list will be generated due to timeouts or other problems.

getTime

public java.util.Date getTime()
Get the time from the server.

Returns:
A Date object containing the server time, adjusted for roundtrip delay. Note that it is better to use getInfo() and then to use the offset field of the returned NtpInfo object.

close

public void close()

finalize

public void finalize()
Overrides:
finalize in class java.lang.Object