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 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(DatagramPacket request, byte[] response)
addRequestResponseprotected boolean
attemptConversation(DatagramSocket socket)
attemptConversationInetAddress
getInetAddress()
getInetAddressint
getPort()
getPortSimpleServerRunnable
getRunnable()
getRunnableint
getTimeout()
getTimeoutvoid
onInit()
onInitprotected SimpleUDPServer.RequestMatcher
recievedPacket(DatagramPacket request)
recievedPacketvoid
setInetAddress(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 IOException
startServer
- Throws:
Exception
- if any.IOException
-
stopServer
public void stopServer() throws IOException
stopServer
- Throws:
IOException
- if any.
-
getRunnable
public SimpleServerRunnable getRunnable() throws IOException
getRunnable
- Returns:
- a
Runnable
object. - 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
- aDatagramSocket
object.- Returns:
- a boolean.
- Throws:
IOException
- if any.
-
addRequestResponse
protected void addRequestResponse(DatagramPacket request, byte[] response)
addRequestResponse
- Parameters:
request
- aDatagramPacket
object.response
- an array of byte.
-
recievedPacket
protected SimpleUDPServer.RequestMatcher recievedPacket(DatagramPacket request)
recievedPacket
- Parameters:
request
- aDatagramPacket
object.- Returns:
- a
SimpleUDPServer.RequestMatcher
object.
-
setInetAddress
public void setInetAddress(InetAddress testInetAddress)
setInetAddress
- Parameters:
testInetAddress
- aInetAddress
object.
-
getInetAddress
public InetAddress getInetAddress()
getInetAddress
- Returns:
- a
InetAddress
object.
-
-