NetworkEndPoint, NetworkReceiverpublic class DatagramReceiver extends java.lang.Object implements NetworkReceiver
NetworkEndPoint.State| Modifier and Type | Method | Description |
|---|---|---|
static DatagramReceiver |
create(java.net.ProtocolFamily protocolFamily) |
Creates a datagram receiver.
|
java.util.Set<java.net.InetAddress> |
getGroups() |
Returns the multicast groups associated with this receiver.
|
int |
getHandlerThreadPriority() |
Returns the priority of the handler threads in this receiver.
|
int |
getHandlerThreads() |
Returns the number of the handler threads in this receiver.
|
java.net.InetAddress |
getLocalAddress() |
Returns the local address of this end point.
|
java.net.InetSocketAddress |
getLocalEndPoint() |
Returns the local end point of this receiver.
|
int |
getLocalPort() |
Returns the local port of this end point.
|
java.net.NetworkInterface |
getNetworkInterface() |
Returns the network interface associated with this end point.
|
int |
getReceiveBufferSize() |
Returns the receive buffer size of this receiver.
|
int |
getReceiverThreadPriority() |
Returns the priority of the receiver threads in this receiver.
|
int |
getReceiverThreads() |
Returns the number of the receiver threads in this receiver.
|
NetworkEndPoint.State |
getState() |
Returns the state of this end point.
|
void |
start() |
Starts this end point.
|
void |
stop() |
Stops this end point.
|
DatagramReceiver |
withGroups(java.util.Set<java.net.InetAddress> groups) |
Sets the multicast groups associated with this receiver.
|
DatagramReceiver |
withHandlerThreadPriority(int threadPriority) |
Sets the priority of the handler threads in this receiver.
|
DatagramReceiver |
withHandlerThreads(int threads) |
Sets the number of the handler threads in this receiver.
|
DatagramReceiver |
withLocalAddressAndPort(java.net.InetAddress localAddress,
int localPort) |
Sets the local address and port of this receiver.
|
DatagramReceiver |
withLocalPort(int localPort) |
Sets the local port of this receiver.
|
DatagramReceiver |
withMessageConsumer(java.util.function.Consumer<NetworkMessage> messageConsumer) |
Sets the message consumer of this receiver.
|
DatagramReceiver |
withNetworkInterface(java.net.NetworkInterface networkInterface) |
Sets the network interface associated with this receiver.
|
DatagramReceiver |
withReceiveBufferSize(int bufferSize) |
Sets the receive buffer size of this receiver.
|
DatagramReceiver |
withReceiverThreadPriority(int threadPriority) |
Sets the priority of the receiver threads in this receiver.
|
DatagramReceiver |
withReceiverThreads(int threads) |
Sets the number of the receiver threads in this receiver.
|
public static DatagramReceiver create(java.net.ProtocolFamily protocolFamily)
java.lang.IllegalArgumentException - if protocolFamily is nullpublic java.util.Set<java.net.InetAddress> getGroups()
public int getHandlerThreadPriority()
public int getHandlerThreads()
public java.net.InetAddress getLocalAddress()
NetworkEndPointgetLocalAddress in interface NetworkEndPointpublic java.net.InetSocketAddress getLocalEndPoint()
NetworkReceivergetLocalEndPoint in interface NetworkReceiverpublic int getLocalPort()
NetworkEndPointgetLocalPort in interface NetworkEndPointpublic java.net.NetworkInterface getNetworkInterface()
NetworkEndPointgetNetworkInterface in interface NetworkEndPointpublic int getReceiveBufferSize()
NetworkReceivergetReceiveBufferSize in interface NetworkReceiverpublic int getReceiverThreadPriority()
public int getReceiverThreads()
public NetworkEndPoint.State getState()
NetworkEndPointgetState in interface NetworkEndPointpublic void start()
throws java.io.IOException
NetworkEndPointstart in interface NetworkEndPointjava.io.IOExceptionpublic void stop()
NetworkEndPointstop in interface NetworkEndPointpublic DatagramReceiver withHandlerThreadPriority(int threadPriority)
java.lang.IllegalArgumentException - if threadPriority is not validjava.lang.IllegalStateException - if this receiver has already been startedThread.MAX_PRIORITY,
Thread.MIN_PRIORITYpublic DatagramReceiver withGroups(java.util.Set<java.net.InetAddress> groups)
java.lang.IllegalArgumentException - if groups are nulljava.lang.IllegalStateException - if this receiver has already been startedpublic DatagramReceiver withHandlerThreads(int threads)
java.lang.IllegalArgumentException - if threads is not positivejava.lang.IllegalStateException - if this receiver has already been startedpublic DatagramReceiver withLocalAddressAndPort(java.net.InetAddress localAddress, int localPort)
java.lang.IllegalArgumentException - if localAddress is nulljava.lang.IllegalArgumentException - if localPort is invalidjava.lang.IllegalStateException - if this receiver has already been startedpublic DatagramReceiver withLocalPort(int localPort)
java.lang.IllegalArgumentException - if localPort is invalidjava.lang.IllegalStateException - if this receiver has already been startedpublic DatagramReceiver withMessageConsumer(java.util.function.Consumer<NetworkMessage> messageConsumer)
java.lang.IllegalArgumentException - if messageConsumer is nulljava.lang.IllegalStateException - if this receiver has already been startedpublic DatagramReceiver withNetworkInterface(java.net.NetworkInterface networkInterface)
java.lang.IllegalArgumentException - if networkInterface is nulljava.lang.IllegalStateException - if this receiver has already been startedpublic DatagramReceiver withReceiveBufferSize(int bufferSize)
java.lang.IllegalArgumentException - if bufferSize is negativejava.lang.IllegalStateException - if this receiver has already been startedpublic DatagramReceiver withReceiverThreadPriority(int threadPriority)
java.lang.IllegalArgumentException - if threadPriority is not validjava.lang.IllegalStateException - if this receiver has already been startedThread.MAX_PRIORITY,
Thread.MIN_PRIORITYpublic DatagramReceiver withReceiverThreads(int threads)
java.lang.IllegalArgumentException - if threads is not positivejava.lang.IllegalStateException - if this receiver has already been started