XNIO API 2.0.0.GA

org.jboss.xnio.channels
Interface UdpChannel

All Superinterfaces:
BoundChannel<java.net.InetSocketAddress>, java.nio.channels.Channel, java.io.Closeable, CloseableChannel, Configurable, MultipointDatagramChannel<java.net.InetSocketAddress>, MultipointMessageChannel<java.net.InetSocketAddress>, MultipointReadableMessageChannel<java.net.InetSocketAddress>, MultipointWritableMessageChannel<java.net.InetSocketAddress>, SuspendableChannel, SuspendableReadChannel, SuspendableWriteChannel

public interface UdpChannel
extends MultipointDatagramChannel<java.net.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 handler for this channel.
 ChannelListener.Setter<? extends UdpChannel> getReadSetter()
          Get the setter which can be used to change the read handler for this channel.
 ChannelListener.Setter<? extends UdpChannel> getWriteSetter()
          Get the setter which can be used to change the write handler for this channel.
 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, 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(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

getReadSetter

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

Specified by:
getReadSetter in interface MultipointDatagramChannel<java.net.InetSocketAddress>
Specified by:
getReadSetter in interface MultipointMessageChannel<java.net.InetSocketAddress>
Specified by:
getReadSetter in interface MultipointReadableMessageChannel<java.net.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 handler for this channel. If the channel is already closed, then the handler will not be called.

Specified by:
getCloseSetter in interface BoundChannel<java.net.InetSocketAddress>
Specified by:
getCloseSetter in interface CloseableChannel
Specified by:
getCloseSetter in interface MultipointDatagramChannel<java.net.InetSocketAddress>
Specified by:
getCloseSetter in interface MultipointMessageChannel<java.net.InetSocketAddress>
Specified by:
getCloseSetter in interface MultipointReadableMessageChannel<java.net.InetSocketAddress>
Specified by:
getCloseSetter in interface MultipointWritableMessageChannel<java.net.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 handler for this channel. When the handler is called, additional notifications are automatically suspended.

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

XNIO API 2.0.0.GA

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