org.jboss.xnio.channels
Interface UdpChannel

All Superinterfaces:
BoundChannel<java.net.SocketAddress>, java.nio.channels.Channel, java.io.Closeable, Configurable, MultipointDatagramChannel<java.net.SocketAddress>, MultipointMessageChannel<java.net.SocketAddress>, MultipointReadableMessageChannel<java.net.SocketAddress>, MultipointWritableMessageChannel<java.net.SocketAddress>, SuspendableChannel, SuspendableReadChannel, SuspendableWriteChannel
All Known Implementing Classes:
BioDatagramChannelImpl, BioMulticastChannelImpl, NioUdpSocketChannelImpl

public interface UdpChannel
extends MultipointDatagramChannel<java.net.SocketAddress>

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
 UdpChannel.Key join(java.net.InetAddress group, java.net.NetworkInterface iface)
          Join a multicast group to begin receiving all datagrams sent to the group.
 UdpChannel.Key join(java.net.InetAddress group, java.net.NetworkInterface iface, java.net.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, resumeWrites, shutdownWrites, suspendWrites
 
Methods inherited from interface java.nio.channels.Channel
close, isOpen
 
Methods inherited from interface org.jboss.xnio.channels.Configurable
getOption, getOptions, setOption
 
Methods inherited from interface org.jboss.xnio.channels.BoundChannel
getLocalAddress
 

Method Detail

join

UdpChannel.Key join(java.net.InetAddress group,
                    java.net.NetworkInterface iface)
                    throws java.io.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:
java.io.IOException - if an I/O error occurs
java.lang.IllegalStateException - if the channel is already a member of the group on this interface
java.lang.IllegalArgumentException - if the group parameters is not a multicast address, or is an unsupported address type
java.lang.SecurityException - if a security manager is set, and its SecurityManager.checkMulticast(java.net.InetAddress) method denies access to the group

join

UdpChannel.Key join(java.net.InetAddress group,
                    java.net.NetworkInterface iface,
                    java.net.InetAddress source)
                    throws java.io.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:
java.io.IOException - if an I/O error occurs
java.lang.IllegalStateException - if the channel is already a member of the group on this interface
java.lang.IllegalArgumentException - if the group parameters is not a multicast address, or is an unsupported address type
java.lang.SecurityException - if a security manager is set, and its SecurityManager.checkMulticast(java.net.InetAddress) method denies access to the group
java.lang.UnsupportedOperationException - if the implementation does not support source filtering