|
![]() |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ipworks.Netclock
The NetClock control provides the current (GMT) time from an Internet Time Server.
The address of the Time Server is provided in the TimeServer
property. You get the time by calling the GetTime
method or
setting the Action
property to netclockGetTime .
The control also allows you to synchronize your system time
with that of the TimeServer
. This is done through the GetAndSetTime
method or the Action
property. Setting Action
to netclockGetAndSetTime will request the time from the
server and then set the system clock to match it.
Field Summary | |
static int |
netclockGetAndSetTime
|
static int |
netclockGetTime
|
static int |
netclockIdle
|
Constructor Summary | |
Netclock()
|
Method Summary | |
void |
addNetclockEventListener(NetclockEventListener l)
|
void |
fireError(int errorCode,
java.lang.String description)
Information about errors during data delivery. |
int |
getAction()
An action code for the control. |
void |
getAndSetTime()
Same as the netclockGetTime action, but system clock is also set to the received time. |
java.lang.String |
getLocalHost()
The name of the local host or user-assigned IP interface through which connections are initiated or accepted. |
java.lang.String |
getLocalTime()
The time returned by the TimeServer converted to local time. |
java.lang.String |
getServerTime()
The time returned by the TimeServer . |
void |
getTime()
Sends a time request to the TimeServer to ge the current time. |
int |
getTimeout()
A timeout for the component. |
int |
getTimePort()
The UDP port where the remote Time server is listening. |
java.lang.String |
getTimeServer()
The time server to request the time from. |
void |
removeNetclockEventListener(NetclockEventListener l)
|
void |
setAction(int action)
An action code for the control. |
void |
setLocalHost(java.lang.String localHost)
The name of the local host or user-assigned IP interface through which connections are initiated or accepted. |
void |
setTimeout(int timeout)
A timeout for the component. |
void |
setTimePort(int timePort)
The UDP port where the remote Time server is listening. |
void |
setTimeServer(java.lang.String timeServer)
The time server to request the time from. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int netclockIdle
public static final int netclockGetTime
public static final int netclockGetAndSetTime
Constructor Detail |
public Netclock()
Method Detail |
public int getAction()
Action
property and the corresponding descriptions:
TimeServer
on port 37. The reply is provided in the ServerTime
property.
After a successful time request has completed, the control returns to netclockIdle .
public void setAction(int action) throws IPWorksException
Action
property and the corresponding descriptions:
TimeServer
on port 37. The reply is provided in the ServerTime
property.
After a successful time request has completed, the control returns to netclockIdle .
public java.lang.String getLocalHost()
LocalHost
property contains the name of the local host
as obtained by the gethostname() Winsock call, or if the
user has assigned an IP address, the value of that address.
In multihomed hosts (machines with more than one IP interface) setting LocalHost to the value of an interface will make the control initiate connections (or accept in the case of server controls) only through that interface.
If the control is connected, the LocalHost
property shows
the IP address of the interface through which the connection
is made in internet dotted format (aaa.bbb.ccc.ddd). In most
cases, this is the address of the local host, except for multihomed
hosts (machines with more than one IP interface).
NOTE: LocalHost
is not persistent. You must always set it in
code, and never in the property window.
public void setLocalHost(java.lang.String localHost) throws IPWorksException
LocalHost
property contains the name of the local host
as obtained by the gethostname() Winsock call, or if the
user has assigned an IP address, the value of that address.
In multihomed hosts (machines with more than one IP interface) setting LocalHost to the value of an interface will make the control initiate connections (or accept in the case of server controls) only through that interface.
If the control is connected, the LocalHost
property shows
the IP address of the interface through which the connection
is made in internet dotted format (aaa.bbb.ccc.ddd). In most
cases, this is the address of the local host, except for multihomed
hosts (machines with more than one IP interface).
NOTE: LocalHost
is not persistent. You must always set it in
code, and never in the property window.
public java.lang.String getLocalTime()
public java.lang.String getServerTime()
For the corresponding local time, please consult the LocalTime
property.
public int getTimeout()
Timeout
is set to a positive value, and an operation cannot
be completed immediately, the control will retry the operation
for a maximum of Timeout
seconds.
The default value for Timeout
is 10 (seconds).
public void setTimeout(int timeout) throws IPWorksException
Timeout
is set to a positive value, and an operation cannot
be completed immediately, the control will retry the operation
for a maximum of Timeout
seconds.
The default value for Timeout
is 10 (seconds).
public int getTimePort()
TimePort
is the UDP port on the TimeServer
where to
send Time requests to.
public void setTimePort(int timePort) throws IPWorksException
TimePort
is the UDP port on the TimeServer
where to
send Time requests to.
public java.lang.String getTimeServer()
Time request are sent to port TimePort
(default 37)
on the TimeServer
.
public void setTimeServer(java.lang.String timeServer) throws IPWorksException
Time request are sent to port TimePort
(default 37)
on the TimeServer
.
public void fireError(int errorCode, java.lang.String description)
NetclockErrorEvent
public void getAndSetTime() throws IPWorksException
Calling this method is equivalent to setting the Action
property
to netclockGetAndSetTime .
public void getTime() throws IPWorksException
TimeServer
on port 37. The reply is provided in the ServerTime
property, and the equivalent local time is provided in the LocalTime
property.
Calling this method is equivalent to setting the Action
property
to netclockGetTime .
public void addNetclockEventListener(NetclockEventListener l) throws java.util.TooManyListenersException
public void removeNetclockEventListener(NetclockEventListener l)
|
![]() |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |