Class NtpClient
- java.lang.Object
-
- org.opennms.netmgt.provision.detector.datagram.client.NtpClient
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Client<NtpMessage,DatagramPacket>
@Component @Scope("prototype") public class NtpClient extends Object implements Client<NtpMessage,DatagramPacket>
-
-
Constructor Summary
Constructors Constructor Description NtpClient()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
closevoid
connect(InetAddress address, int port, int timeout)
connectInetAddress
getAddress()
getAddressint
getPort()
getPortDatagramPacket
receiveBanner()
receiveBannerDatagramPacket
sendRequest(NtpMessage request)
sendRequestprotected void
setAddress(InetAddress address)
setAddressprotected void
setPort(int port)
setPort
-
-
-
Method Detail
-
close
public void close()
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceClient<NtpMessage,DatagramPacket>
- Specified by:
close
in interfaceCloseable
-
connect
public void connect(InetAddress address, int port, int timeout) throws IOException, Exception
connect
- Specified by:
connect
in interfaceClient<NtpMessage,DatagramPacket>
- Parameters:
address
- aInetAddress
object.port
- a int.timeout
- a int.- Throws:
IOException
- if any.Exception
- if any.
-
receiveBanner
public DatagramPacket receiveBanner() throws IOException, Exception
receiveBanner
- Specified by:
receiveBanner
in interfaceClient<NtpMessage,DatagramPacket>
- Returns:
- a
DatagramPacket
object. - Throws:
IOException
- if any.Exception
- if any.
-
sendRequest
public DatagramPacket sendRequest(NtpMessage request) throws IOException, Exception
sendRequest
- Specified by:
sendRequest
in interfaceClient<NtpMessage,DatagramPacket>
- Parameters:
request
- aNtpMessage
object.- Returns:
- a
DatagramPacket
object. - Throws:
IOException
- if any.Exception
- if any.
-
setAddress
protected void setAddress(InetAddress address)
setAddress
- Parameters:
address
- aInetAddress
object.
-
getAddress
public InetAddress getAddress()
getAddress
- Returns:
- a
InetAddress
object.
-
setPort
protected void setPort(int port)
setPort
- Parameters:
port
- a int.
-
getPort
public int getPort()
getPort
- Returns:
- a int.
-
-