NetworkEndPoint, NetworkSenderpublic class DatagramSender extends java.lang.Object implements NetworkSender
NetworkEndPoint.State| Modifier and Type | Method | Description |
|---|---|---|
static DatagramSender |
create(java.net.ProtocolFamily protocolFamily) |
Creates a datagram sender.
|
java.net.InetAddress |
getLocalAddress() |
Returns the local address of this end point.
|
java.net.InetSocketAddress |
getLocalEndPoint() |
Returns the local end point of this sender.
|
int |
getLocalPort() |
Returns the local port of this end point.
|
java.net.NetworkInterface |
getNetworkInterface() |
Returns the network interface associated with this end point.
|
int |
getSendBufferSize() |
Returns the send buffer size of this sender.
|
int |
getSenderThreadPriority() |
Returns the priority of the sender threads in this sender.
|
int |
getSenderThreads() |
Returns the number of the sender threads in this sender.
|
int |
getSendRepeatCount() |
Returns the send repeat count of this sender.
|
long |
getSendRepeatInterval() |
Returns the send repeat interval (in milliseconds) of this sender.
|
NetworkEndPoint.State |
getState() |
Returns the state of this end point.
|
int |
getTimeToLive() |
Returns the TTL of multicast packets sent by this sender.
|
TrafficClass |
getTrafficClass() |
Returns the traffic class of datagrams sent by this sender.
|
void |
sendDelayed(NetworkMessage message,
long initialDelay,
java.util.concurrent.TimeUnit unit) |
Sends the given message after the given initial delay.
|
void |
sendImmediately(NetworkMessage message) |
Sends the given message immediately.
|
void |
start() |
Starts this end point.
|
void |
stop() |
Stops this end point.
|
DatagramSender |
withLocalAddressAndPort(java.net.InetAddress localAddress,
int localPort) |
Sets the local address and port of this sender.
|
DatagramSender |
withLocalPort(int localPort) |
Sets the local port of this sender.
|
DatagramSender |
withMulticast(java.net.NetworkInterface networkInterface) |
Enables multicast on this sender over the given network interface.
|
DatagramSender |
withSendBufferSize(int bufferSize) |
Sets the send buffer size of this sender.
|
DatagramSender |
withSenderThreadPriority(int threadPriority) |
Sets the priority of the sender threads in this sender.
|
DatagramSender |
withSenderThreads(int threads) |
Sets the number of the sender threads in this sender.
|
DatagramSender |
withSendRepeatCount(int repeatCount) |
Sets the send repeat count of this sender.
|
DatagramSender |
withSendRepeatInterval(int repeatInterval) |
Sets the send repeat interval (in milliseconds) of this sender.
|
DatagramSender |
withTimeToLive(int timeToLive) |
Sets the TTL of multicast packets sent by this sender.
|
DatagramSender |
withTrafficClass(TrafficClass trafficClass) |
Sets the traffic class of datagrams sent by this sender.
|
public static DatagramSender create(java.net.ProtocolFamily protocolFamily)
java.lang.IllegalArgumentException - if protocolFamily is nullpublic java.net.InetAddress getLocalAddress()
NetworkEndPointgetLocalAddress in interface NetworkEndPointpublic java.net.InetSocketAddress getLocalEndPoint()
NetworkSendergetLocalEndPoint in interface NetworkSenderpublic int getLocalPort()
NetworkEndPointgetLocalPort in interface NetworkEndPointpublic java.net.NetworkInterface getNetworkInterface()
NetworkEndPointgetNetworkInterface in interface NetworkEndPointpublic int getSendBufferSize()
NetworkSendergetSendBufferSize in interface NetworkSenderpublic int getSendRepeatCount()
public long getSendRepeatInterval()
public int getSenderThreadPriority()
public int getSenderThreads()
public NetworkEndPoint.State getState()
NetworkEndPointgetState in interface NetworkEndPointpublic int getTimeToLive()
public TrafficClass getTrafficClass()
public void sendDelayed(NetworkMessage message, long initialDelay, java.util.concurrent.TimeUnit unit)
NetworkSendersendDelayed in interface NetworkSenderpublic void sendImmediately(NetworkMessage message)
NetworkSendersendImmediately in interface NetworkSenderpublic void start()
throws java.io.IOException
NetworkEndPointstart in interface NetworkEndPointjava.io.IOExceptionpublic void stop()
NetworkEndPointstop in interface NetworkEndPointpublic DatagramSender withLocalAddressAndPort(java.net.InetAddress localAddress, int localPort)
java.lang.IllegalArgumentException - if localAddress is nulljava.lang.IllegalArgumentException - if localPort is invalidjava.lang.IllegalStateException - if this sender has already been startedpublic DatagramSender withLocalPort(int localPort)
java.lang.IllegalArgumentException - if localPort is invalidjava.lang.IllegalStateException - if this sender has already been startedpublic DatagramSender withMulticast(java.net.NetworkInterface networkInterface)
java.lang.IllegalArgumentException - if networkInterface is nulljava.lang.IllegalStateException - if this sender has already been startedpublic DatagramSender withSendBufferSize(int bufferSize)
java.lang.IllegalArgumentException - if bufferSize is negativejava.lang.IllegalStateException - if this sender has already been startedpublic DatagramSender withSendRepeatCount(int repeatCount)
java.lang.IllegalArgumentException - if repeatCount is negativejava.lang.IllegalStateException - if this sender has already been startedpublic DatagramSender withSendRepeatInterval(int repeatInterval)
java.lang.IllegalArgumentException - if repeatInterval is negativejava.lang.IllegalStateException - if this sender has already been startedpublic DatagramSender withSenderThreadPriority(int threadPriority)
java.lang.IllegalArgumentException - if threadPriority is not validjava.lang.IllegalStateException - if this sender has already been startedThread.MAX_PRIORITY,
Thread.MIN_PRIORITYpublic DatagramSender withSenderThreads(int threads)
java.lang.IllegalArgumentException - if threads is not positivejava.lang.IllegalStateException - if this sender has already been startedpublic DatagramSender withTimeToLive(int timeToLive)
java.lang.IllegalArgumentException - if timeToLive is not positivejava.lang.IllegalStateException - if this sender has already been startedpublic DatagramSender withTrafficClass(TrafficClass trafficClass)
java.lang.IllegalArgumentException - if trafficClass is nulljava.lang.IllegalStateException - if this sender has already been started