XNIO API 2.1.0.CR2

org.jboss.xnio.channels
Interface UdpChannel

All Superinterfaces:
BoundChannel<InetSocketAddress>, Channel, Closeable, CloseableChannel, Configurable, MultipointDatagramChannel<InetSocketAddress>, MultipointMessageChannel<InetSocketAddress>, MultipointReadableMessageChannel<InetSocketAddress>, MultipointWritableMessageChannel<InetSocketAddress>, SuspendableChannel, SuspendableReadChannel, SuspendableWriteChannel

public interface UdpChannel
extends MultipointDatagramChannel<InetSocketAddress>

A UDP channel. UDP channels are multipoint datagram channels which always use a SocketAddress and additionally support multicast registration.


Nested Class Summary
static interface UdpChannel.Key
          A registration key for a multicast group.
 
Method Summary
 ChannelListener.Setter<? extends UdpChannel> getCloseSetter()
          Get the setter which can be used to change the close listener for this channel.
 ChannelListener.Setter<? extends UdpChannel> getReadSetter()
          Get the setter which can be used to change the read listener for this channel.
 ChannelListener.Setter<? extends UdpChannel> getWriteSetter()
          Get the setter which can be used to change the write listener for this channel.
 UdpChannel.Key join(InetAddress group, NetworkInterface iface)
          Join a multicast group to begin receiving all datagrams sent to the group.
 UdpChannel.Key join(InetAddress group, NetworkInterface iface, InetAddress source)
          Join a multicast group to begin receiving all datagrams sent to the group from a given source address.
 
Methods inherited from interface org.jboss.xnio.channels.MultipointReadableMessageChannel
receive
 
Methods inherited from interface org.jboss.xnio.channels.MultipointWritableMessageChannel
send, send, send
 
Methods inherited from interface org.jboss.xnio.channels.SuspendableReadChannel
awaitReadable, awaitReadable, resumeReads, shutdownReads, suspendReads
 
Methods inherited from interface org.jboss.xnio.channels.SuspendableWriteChannel
awaitWritable, awaitWritable, flush, resumeWrites, shutdownWrites, suspendWrites
 
Methods inherited from interface java.nio.channels.Channel
close, isOpen
 
Methods inherited from interface org.jboss.xnio.channels.Configurable
getOption, setOption, supportsOption
 
Methods inherited from interface org.jboss.xnio.channels.BoundChannel
getLocalAddress
 

Method Detail

join

UdpChannel.Key join(InetAddress group,
                    NetworkInterface iface)
                    throws IOException
Join a multicast group to begin receiving all datagrams sent to the group. A multicast channel may join several multicast groups, including the same group on more than one interface. An implementation may impose a limit on the number of groups that may be joined at the same time.

Parameters:
group - the multicast address to join
iface - the network interface to join on
Returns:
a new key
Throws:
IOException - if an I/O error occurs
IllegalStateException - if the channel is already a member of the group on this interface
IllegalArgumentException - if the group parameters is not a multicast address, or is an unsupported address type
SecurityException - if a security manager is set, and its SecurityManager.checkMulticast(java.net.InetAddress) method denies access to the group

join

UdpChannel.Key join(InetAddress group,
                    NetworkInterface iface,
                    InetAddress source)
                    throws IOException
Join a multicast group to begin receiving all datagrams sent to the group from a given source address. A multicast channel may join several multicast groups, including the same group on more than one interface. An implementation may impose a limit on the number of groups that may be joined at the same time.

Parameters:
group - the multicast address to join
iface - the network interface to join on
source - the source address to listen for
Returns:
a new key
Throws:
IOException - if an I/O error occurs
IllegalStateException - if the channel is already a member of the group on this interface
IllegalArgumentException - if the group parameters is not a multicast address, or is an unsupported address type
SecurityException - if a security manager is set, and its SecurityManager.checkMulticast(java.net.InetAddress) method denies access to the group
UnsupportedOperationException - if the implementation does not support source filtering

getReadSetter

ChannelListener.Setter<? extends UdpChannel> getReadSetter()
Get the setter which can be used to change the read listener for this channel. When the listener is called, additional notifications are automatically suspended.

Specified by:
getReadSetter in interface MultipointDatagramChannel<InetSocketAddress>
Specified by:
getReadSetter in interface MultipointMessageChannel<InetSocketAddress>
Specified by:
getReadSetter in interface MultipointReadableMessageChannel<InetSocketAddress>
Specified by:
getReadSetter in interface SuspendableChannel
Specified by:
getReadSetter in interface SuspendableReadChannel
Returns:
the setter

getCloseSetter

ChannelListener.Setter<? extends UdpChannel> getCloseSetter()
Get the setter which can be used to change the close listener for this channel. If the channel is already closed, then the listener will not be called.

Specified by:
getCloseSetter in interface BoundChannel<InetSocketAddress>
Specified by:
getCloseSetter in interface CloseableChannel
Specified by:
getCloseSetter in interface MultipointDatagramChannel<InetSocketAddress>
Specified by:
getCloseSetter in interface MultipointMessageChannel<InetSocketAddress>
Specified by:
getCloseSetter in interface MultipointReadableMessageChannel<InetSocketAddress>
Specified by:
getCloseSetter in interface MultipointWritableMessageChannel<InetSocketAddress>
Specified by:
getCloseSetter in interface SuspendableChannel
Specified by:
getCloseSetter in interface SuspendableReadChannel
Specified by:
getCloseSetter in interface SuspendableWriteChannel
Returns:
the setter

getWriteSetter

ChannelListener.Setter<? extends UdpChannel> getWriteSetter()
Get the setter which can be used to change the write listener for this channel. When the listener is called, additional notifications are automatically suspended.

Specified by:
getWriteSetter in interface MultipointDatagramChannel<InetSocketAddress>
Specified by:
getWriteSetter in interface MultipointMessageChannel<InetSocketAddress>
Specified by:
getWriteSetter in interface MultipointWritableMessageChannel<InetSocketAddress>
Specified by:
getWriteSetter in interface SuspendableChannel
Specified by:
getWriteSetter in interface SuspendableWriteChannel
Returns:
the setter

XNIO API 2.1.0.CR2

Copyright © 2010 JBoss, a division of Red Hat, Inc.