Class SimpleUDPServer
- java.lang.Object
-
- org.opennms.netmgt.provision.server.SimpleUDPServer
-
public class SimpleUDPServer extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
SimpleUDPServer.Exchange
static interface
SimpleUDPServer.RequestMatcher
static class
SimpleUDPServer.SimpleServerExchange
-
Constructor Summary
Constructors Constructor Description SimpleUDPServer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addRequestResponse(java.net.DatagramPacket request, byte[] response)
addRequestResponseprotected boolean
attemptConversation(java.net.DatagramSocket socket)
attemptConversationjava.net.InetAddress
getInetAddress()
getInetAddressint
getPort()
getPortSimpleServerRunnable
getRunnable()
getRunnableint
getTimeout()
getTimeoutvoid
onInit()
onInitprotected SimpleUDPServer.RequestMatcher
recievedPacket(java.net.DatagramPacket request)
recievedPacketvoid
setInetAddress(java.net.InetAddress testInetAddress)
setInetAddressvoid
setPort(int port)
setPortvoid
setTimeout(int timeout)
setTimeoutvoid
startServer()
startServervoid
stopServer()
stopServer
-
-
-
Method Detail
-
onInit
public void onInit()
onInit
-
startServer
public void startServer() throws java.io.IOException
startServer
- Throws:
java.lang.Exception
- if any.java.io.IOException
-
stopServer
public void stopServer() throws java.io.IOException
stopServer
- Throws:
java.io.IOException
- if any.
-
getRunnable
public SimpleServerRunnable getRunnable() throws java.io.IOException
getRunnable
- Returns:
- a
Runnable
object. - Throws:
java.lang.Exception
- if any.java.io.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(java.net.DatagramSocket socket) throws java.io.IOException
attemptConversation
- Parameters:
socket
- aDatagramSocket
object.- Returns:
- a boolean.
- Throws:
java.io.IOException
- if any.
-
addRequestResponse
protected void addRequestResponse(java.net.DatagramPacket request, byte[] response)
addRequestResponse
- Parameters:
request
- aDatagramPacket
object.response
- an array of byte.
-
recievedPacket
protected SimpleUDPServer.RequestMatcher recievedPacket(java.net.DatagramPacket request)
recievedPacket
- Parameters:
request
- aDatagramPacket
object.- Returns:
- a
SimpleUDPServer.RequestMatcher
object.
-
setInetAddress
public void setInetAddress(java.net.InetAddress testInetAddress)
setInetAddress
- Parameters:
testInetAddress
- aInetAddress
object.
-
getInetAddress
public java.net.InetAddress getInetAddress()
getInetAddress
- Returns:
- a
InetAddress
object.
-
-