public class PduMulticastReceiver extends UdpServer
A UDP server that receives DIS PDU packets and fires off events to interested parties. The event firing is on the socket-processing thread, so be quick about handling the events.
Using the new ByteBuffer
-based marshalling is
more efficient than the old IO Streams technique, and it also supports
receiving several DIS PDUs in a single UDP datagram. Each datagram
is scraped sequentially so that if one PDU is placed after another,
they will each be unmarshalled, and an event will be fired off for
each one in turn.
Modifier and Type | Class and Description |
---|---|
static class |
PduMulticastReceiver.Event |
static interface |
PduMulticastReceiver.Listener |
UdpServer.Adapter, UdpServer.State
GROUPS_PROP, PORT_PROP
Constructor and Description |
---|
PduMulticastReceiver()
Creates a new instance of PduMulticastReceiver that is
in the
UdpServer.State.STOPPED state |
Modifier and Type | Method and Description |
---|---|
void |
addPduMulticastReceiverListener(PduMulticastReceiver.Listener l)
Adds a
PduMulticastReceiver.Listener . |
protected void |
firePduReceived()
Fires event on calling thread.
|
Pdu |
getPdu()
Returns the last parsed PDU.
|
boolean |
getUseByteBuffer()
Returns whether or not the ByteBuffer marshalling
technique is being used (default).
|
boolean |
getUseFastPdu()
Returns whether or not FastEspdu objects
are created which use less memory since
all their fields are flattened to primitives
instead of several objects.
|
void |
removePduMulticastReceiverListener(PduMulticastReceiver.Listener l)
Removes a
PduMulticastReceiver.Listener . |
void |
setUseByteBuffer(boolean use)
Sets whether or not to use the more efficient
ByteBuffer marshalling technique (default).
|
void |
setUseFastEspdu(boolean use)
Sets whether or not to generate the
Fast Espdu packets (all primitive fields).
|
addPropertyChangeListener, addPropertyChangeListener, addUdpServerListener, fireProperties, firePropertyChange, fireState, fireUdpServerPacketReceived, fireUdpServerStateChanged, getGroups, getLoggingLevel, getPacket, getPort, getReceiveBufferSize, getState, recordState, removePropertyChangeListener, removePropertyChangeListener, removeUdpServerListener, reset, runServer, setGroups, setLoggingLevel, setPort, setReceiveBufferSize, start, stop
public PduMulticastReceiver()
UdpServer.State.STOPPED
statepublic Pdu getPdu()
public boolean getUseByteBuffer()
public void setUseByteBuffer(boolean use)
use
- whether or not to use itpublic boolean getUseFastPdu()
public void setUseFastEspdu(boolean use)
use
- public void addPduMulticastReceiverListener(PduMulticastReceiver.Listener l)
PduMulticastReceiver.Listener
.l
- the UdpServer.Listenerpublic void removePduMulticastReceiverListener(PduMulticastReceiver.Listener l)
PduMulticastReceiver.Listener
.l
- the UdpServer.Listenerprotected void firePduReceived()