public class UDPNIOConnection extends NIOConnection
Connection
implementation
for the UDPNIOTransport
NIOConnection.SettableIntHolder
Connection.CloseListener, Connection.CloseType
asyncReadQueue, asyncWriteQueue, attributes, channel, closeTypeFlag, connectCloseSemaphor, isBlocking, isStandalone, maxAsyncWriteQueueSize, monitoringConfig, NOTIFICATION_CLOSED_COMPLETE, NOTIFICATION_INITIALIZED, processor, processorSelector, readTimeoutMillis, selectionKey, selectorRunner, transport, writeTimeoutMillis, zeroByteReadCount
Constructor and Description |
---|
UDPNIOConnection(UDPNIOTransport transport,
DatagramChannel channel) |
Modifier and Type | Method and Description |
---|---|
void |
block(InetAddress group,
NetworkInterface networkInterface,
InetAddress source)
Blocks multicast datagrams from the given source address.
|
void |
drop(InetAddress group,
NetworkInterface networkInterface)
Drops non-source specific membership in a multicast group.
|
void |
drop(InetAddress group,
NetworkInterface networkInterface,
InetAddress source)
Drops membership in a multicast group.
|
void |
dropAll(InetAddress group,
NetworkInterface networkInterface)
Drops all active membership in a multicast group.
|
SocketAddress |
getLocalAddress()
Returns the local address of this Connection,
or null if it is unconnected.
|
SocketAddress |
getPeerAddress()
Returns the address of the endpoint this Connection is
connected to, or null if it is unconnected.
|
int |
getReadBufferSize()
Get the default size of
Buffer s, which will be allocated for
reading data from Connection . |
int |
getWriteBufferSize()
Get the default size of
Buffer s, which will be allocated for
writing data to Connection . |
boolean |
isConnected() |
void |
join(InetAddress group,
NetworkInterface networkInterface)
Joins a multicast group to begin receiving all datagrams sent to the
group.
|
void |
join(InetAddress group,
NetworkInterface networkInterface,
InetAddress source)
Joins a multicast group to begin receiving datagrams sent to the group
from a given source address.
|
protected boolean |
notifyReady() |
protected void |
onConnect()
Method will be called, when the connection gets connected.
|
protected void |
onRead(Buffer data,
int size)
Method will be called, when some data was read on the connection
|
protected void |
onWrite(Buffer data,
int size)
Method will be called, when some data was written on the connection
|
protected void |
resetProperties() |
void |
setReadBufferSize(int readBufferSize)
Set the default size of
Buffer s, which will be allocated for
reading data from Connection . |
protected void |
setSelectionKey(SelectionKey selectionKey) |
protected void |
setSelectorRunner(SelectorRunner selectorRunner) |
void |
setWriteBufferSize(int writeBufferSize)
Set the default size of
Buffer s, which will be allocated for
writing data to Connection . |
String |
toString() |
void |
unblock(InetAddress group,
NetworkInterface networkInterface,
InetAddress source)
Unblocks multicast datagrams from the given source address.
|
addCloseListener, attachToSelectorRunner, checkEmptyRead, close, close, close0, closeSilently, configureBlocking, configureStandalone, detachSelectorRunner, disableIOEvent, enableIOEvent, getAsyncReadQueue, getAsyncWriteQueue, getAttributes, getChannel, getMaxAsyncWriteQueueSize, getMonitoringConfig, getProcessor, getProcessorSelector, getReadTimeout, getSelectionKey, getSelectorRunner, getTransport, getWriteTimeout, isBlocking, isOpen, isStandalone, notifyConnectionError, notifyIOEventDisabled, notifyIOEventEnabled, notifyIOEventReady, notifyProbesAccept, notifyProbesBind, notifyProbesClose, notifyProbesConnect, notifyProbesError, notifyProbesRead, notifyProbesWrite, obtainProcessor, obtainProcessorState, preClose, read, read, removeCloseListener, setChannel, setMaxAsyncWriteQueueSize, setProcessor, setProcessorSelector, setReadTimeout, setWriteTimeout, simulateIOEvent, write, write, write, write, write
public UDPNIOConnection(UDPNIOTransport transport, DatagramChannel channel)
public boolean isConnected()
public void join(InetAddress group, NetworkInterface networkInterface) throws IOException
group
- The multicast address to joinnetworkInterface
- The network interface on which to join the groupIOException
public void join(InetAddress group, NetworkInterface networkInterface, InetAddress source) throws IOException
group
- The multicast address to joinnetworkInterface
- The network interface on which to join the groupsource
- The source addressIOException
public void drop(InetAddress group, NetworkInterface networkInterface) throws IOException
group
- The multicast address to joinnetworkInterface
- The network interface on which to join the groupIOException
public void drop(InetAddress group, NetworkInterface networkInterface, InetAddress source) throws IOException
drop(java.net.InetAddress, java.net.NetworkInterface)
.
If the source parameter is not null and this connection doesn't have
source specific membership in the group on the given interface to
receive datagrams then this method call has no effect.
Otherwise this connection drops the source specific group membership.group
- The multicast address to joinnetworkInterface
- The network interface on which to join the groupsource
- The source addressIOException
public void dropAll(InetAddress group, NetworkInterface networkInterface) throws IOException
group
- The multicast address to joinnetworkInterface
- The network interface on which to join the groupIOException
public void block(InetAddress group, NetworkInterface networkInterface, InetAddress source) throws IOException
group
- The multicast address to joinnetworkInterface
- The network interface on which to join the groupsource
- The source address to blockIOException
public void unblock(InetAddress group, NetworkInterface networkInterface, InetAddress source) throws IOException
block(java.net.InetAddress, java.net.NetworkInterface, java.net.InetAddress)
method
then this method unblocks multicast datagrams from the given source address.
If the given source address wasn't blocked then this method has no effect.group
- The multicast address to joinnetworkInterface
- The network interface on which to join the groupsource
- The source address to blockIOException
protected void setSelectionKey(SelectionKey selectionKey)
setSelectionKey
in class NIOConnection
protected void setSelectorRunner(SelectorRunner selectorRunner)
setSelectorRunner
in class NIOConnection
protected boolean notifyReady()
public SocketAddress getPeerAddress()
public SocketAddress getLocalAddress()
protected final void resetProperties()
public int getReadBufferSize()
Buffer
s, which will be allocated for
reading data from Connection
.
The value less or equal to zero will be ignored.Buffer
s, which will be allocated for
reading data from Connection
.public void setReadBufferSize(int readBufferSize)
Buffer
s, which will be allocated for
reading data from Connection
.
The value less or equal to zero will be ignored.readBufferSize
- the default size of Buffer
s, which will
be allocated for reading data from Connection
.public int getWriteBufferSize()
Buffer
s, which will be allocated for
writing data to Connection
.Buffer
s, which will be allocated for
writing data to Connection
.public void setWriteBufferSize(int writeBufferSize)
Buffer
s, which will be allocated for
writing data to Connection
.writeBufferSize
- the default size of Buffer
s, which will
be allocated for writing data to Connection
.protected final void onConnect() throws IOException
IOException
protected final void onRead(Buffer data, int size)
protected final void onWrite(Buffer data, int size)
Copyright © 2013 Oracle Corporation. All Rights Reserved.