The network listener that will receive incoming UDP packets, try to process them, and then send a reply.
More...
|
| NetworkHandler (int port, InetAddress listenAddress) throws SocketException |
| Initialize the NetworkHandler by starting threads and opening the socket. More...
|
|
void | shutdown () |
|
void | run () |
| Main loop of receiving thread - wait until a packet arrives, then try to handle/decode. More...
|
|
|
void | send (SocketAddress destination, byte[] buffer) |
| Prepare and enqueue reply for client request. More...
|
|
String | handle (String payload) |
|
|
static final Logger | log = LogManager.getLogger( NetworkHandler.class ) |
|
The network listener that will receive incoming UDP packets, try to process them, and then send a reply.
Definition at line 27 of file NetworkHandler.java.
org.openslx.imagemaster.localrpc.NetworkHandler.NetworkHandler |
( |
int |
port, |
|
|
InetAddress |
listenAddress |
|
) |
| throws SocketException |
String org.openslx.imagemaster.localrpc.NetworkHandler.handle |
( |
String |
payload | ) |
|
|
private |
void org.openslx.imagemaster.localrpc.NetworkHandler.run |
( |
| ) |
|
Main loop of receiving thread - wait until a packet arrives, then try to handle/decode.
Definition at line 88 of file NetworkHandler.java.
void org.openslx.imagemaster.localrpc.NetworkHandler.send |
( |
SocketAddress |
destination, |
|
|
byte[] |
buffer |
|
) |
| |
|
private |
Prepare and enqueue reply for client request.
Only ever to be called from the receiving thread. The reply message is crafted and then handed over to the sending thread.
- Parameters
-
destination | SocketAddress of the client |
messageId | The same ID the client used in it's request. It's echoed back to the client to enable request bursts, and has no meaning for the server. |
status | A TaskStatus instance to be serialized to json and sent to the client. |
Definition at line 71 of file NetworkHandler.java.
void org.openslx.imagemaster.localrpc.NetworkHandler.shutdown |
( |
| ) |
|
final Gson org.openslx.imagemaster.localrpc.NetworkHandler.gson = new Gson() |
|
private |
final Logger org.openslx.imagemaster.localrpc.NetworkHandler.log = LogManager.getLogger( NetworkHandler.class ) |
|
staticprivate |
final Sender org.openslx.imagemaster.localrpc.NetworkHandler.sender |
|
private |
Thread org.openslx.imagemaster.localrpc.NetworkHandler.sendThread = null |
|
private |
final DatagramSocket org.openslx.imagemaster.localrpc.NetworkHandler.socket |
|
private |
The documentation for this class was generated from the following file: