|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcgl.narada.service.time.ntptime.NtpConnection
public class NtpConnection
This class provides some methods to make UDP connection, send/receive NTP packets
| Field Summary | |
|---|---|
static int |
defaultNtpPort
|
| Constructor Summary | |
|---|---|
NtpConnection(InetAddress iaddr)
Generates a UDP connection and sets the timeout to the default timeout value. |
|
NtpConnection(InetAddress iaddr,
int iport)
Generates a UDP connection and sets timeout to the socket |
|
| Method Summary | |
|---|---|
void |
close()
Closes the connection. |
NtpInfo |
getInfo()
Exchanges NtpDatagramPacket with the server and generates NtpInfo object. |
int |
getTimeout()
Gets the timeout of the connection. |
NtpInfo |
getTSInfo()
This method is intended to be used with ClientDiscrepancy class. |
void |
receive(NtpDatagramPacket ntpDatagramPacket)
Waits for a reply from the server. |
void |
receiveTS(NtpDatagramPacket ntpDatagramPacket,
long offset11)
This method is intended to be used with ClientDiscrepancy class. |
void |
send(NtpDatagramPacket ntpDatagramPacket)
Sends NtpDatagramPacket to the server. |
void |
setBuffer(int start,
int end,
byte[] tbuffer,
byte[] data)
Sets buffer entries from start to end-1 with the given data array |
void |
setTimeout(int timeout)
Sets the timeout of the asociated connection. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int defaultNtpPort
| Constructor Detail |
|---|
public NtpConnection(InetAddress iaddr,
int iport)
throws SocketException
iaddr - InetAddress - InetAddress of the serveriport - int - port number of the server
SocketException - - SocketException is thrown in case of failure
public NtpConnection(InetAddress iaddr)
throws SocketException
iaddr - InetAddress - InetAddress of the server
SocketException - - SocketException is thrown in case of failure| Method Detail |
|---|
public void setBuffer(int start,
int end,
byte[] tbuffer,
byte[] data)
start - int - start valueend - int - end valuetbuffer - byte[] - bufferdata - byte[] - data array to be copied
public NtpInfo getInfo()
throws IOException
IOException - - IOException is thrown in case of socket timeout or connection failure
public NtpInfo getTSInfo()
throws IOException
IOException
public void setTimeout(int timeout)
throws SocketException
timeout - int - value of the timeout
SocketException - - SocketException is thrown in case of connection failurepublic int getTimeout()
public void close()
public void receive(NtpDatagramPacket ntpDatagramPacket)
throws IOException
ntpDatagramPacket - NtpDatagramPacket - NtpDatagramPacket that will be
set to the NtpDatagramPacket received from the server.
IOException - - IOException is thrown in case of socket timeout or connection failure
public void receiveTS(NtpDatagramPacket ntpDatagramPacket,
long offset11)
throws IOException
ntpDatagramPacket - offset11 - long - offset
IOException
public void send(NtpDatagramPacket ntpDatagramPacket)
throws IOException
ntpDatagramPacket - NtpDatagramPacket - NtpDatagramPacket that will be
sent to the server.
IOException - - IOException is thrown in case of connection failure
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||