Class SimpleUDPServer
- java.lang.Object
-
- org.opennms.netmgt.provision.server.SimpleUDPServer
-
public class SimpleUDPServer extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceSimpleUDPServer.Exchangestatic interfaceSimpleUDPServer.RequestMatcherstatic classSimpleUDPServer.SimpleServerExchange
-
Constructor Summary
Constructors Constructor Description SimpleUDPServer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddRequestResponse(DatagramPacket request, byte[] response)addRequestResponseprotected booleanattemptConversation(DatagramSocket socket)attemptConversationInetAddressgetInetAddress()getInetAddressintgetPort()getPortSimpleServerRunnablegetRunnable()getRunnableintgetTimeout()getTimeoutvoidonInit()onInitprotected SimpleUDPServer.RequestMatcherrecievedPacket(DatagramPacket request)recievedPacketvoidsetInetAddress(InetAddress testInetAddress)setInetAddressvoidsetPort(int port)setPortvoidsetTimeout(int timeout)setTimeoutvoidstartServer()startServervoidstopServer()stopServer
-
-
-
Method Detail
-
onInit
public void onInit()
onInit
-
startServer
public void startServer() throws IOExceptionstartServer
- Throws:
Exception- if any.IOException
-
stopServer
public void stopServer() throws IOExceptionstopServer
- Throws:
IOException- if any.
-
getRunnable
public SimpleServerRunnable getRunnable() throws IOException
getRunnable
- Returns:
- a
Runnableobject. - Throws:
Exception- if any.IOException
-
setPort
public void setPort(int port)
setPort
- Parameters:
port- a int.
-
getPort
public int getPort()
getPort
- Returns:
- a int.
-
setTimeout
public void setTimeout(int timeout)
setTimeout
- Parameters:
timeout- a int.
-
getTimeout
public int getTimeout()
getTimeout
- Returns:
- a int.
-
attemptConversation
protected boolean attemptConversation(DatagramSocket socket) throws IOException
attemptConversation
- Parameters:
socket- aDatagramSocketobject.- Returns:
- a boolean.
- Throws:
IOException- if any.
-
addRequestResponse
protected void addRequestResponse(DatagramPacket request, byte[] response)
addRequestResponse
- Parameters:
request- aDatagramPacketobject.response- an array of byte.
-
recievedPacket
protected SimpleUDPServer.RequestMatcher recievedPacket(DatagramPacket request)
recievedPacket
- Parameters:
request- aDatagramPacketobject.- Returns:
- a
SimpleUDPServer.RequestMatcherobject.
-
setInetAddress
public void setInetAddress(InetAddress testInetAddress)
setInetAddress
- Parameters:
testInetAddress- aInetAddressobject.
-
getInetAddress
public InetAddress getInetAddress()
getInetAddress
- Returns:
- a
InetAddressobject.
-
-