A membership key may represent a membership to receive all datagrams sent
to the group, or it may be source-specific, meaning that it
represents a membership that receives only datagrams from a specific source
address. Whether or not a membership key is source-specific may be determined
by invoking its sourceAddress
method.
A membership key is valid upon creation and remains valid until the
membership is dropped by invoking the drop
method, or
the channel is closed. The validity of the membership key may be tested
by invoking its isValid
method.
Where a membership key is not source-specific and the underlying operation
system supports source filtering, then the block
and unblock
methods can be used to block or unblock multicast datagrams
from particular source addresses.
MulticastChannel
Access | Constructor and Description |
---|---|
protected |
Modifier and Type | Method and Description |
---|---|
public abstract MembershipKey | Returns: This membership keyThe source address to block source)Block multicast datagrams from the given source address. |
public abstract MulticastChannel | |
public abstract void | |
public abstract InetAddress | Returns: the multicast groupReturns the multicast group for which this membership key was created. |
public abstract boolean | Returns: true if this membership key is valid, false
otherwiseTells whether or not this membership is valid. |
public abstract NetworkInterface | Returns: the network interfaceReturns the network interface for which this membership key was created. |
public abstract InetAddress | Returns: The source address if this membership key is source-specific, otherwisenull Returns the source address if this membership key is source-specific,
or |
public abstract MembershipKey | Returns: This membership keyThe source address to unblock source)Unblock multicast datagrams from the given source address that was
previously blocked using the |
MembershipKey | back to summary |
---|---|
protected MembershipKey() Initializes a new instance of this class. |
block | back to summary |
---|---|
public abstract MembershipKey block(InetAddress source) throws IOException Block multicast datagrams from the given source address. If this membership key is not source-specific, and the underlying operating system supports source filtering, then this method blocks multicast datagrams from the given source address. If the given source address is already blocked then this method has no effect. After a source address is blocked it may still be possible to receive datagrams from that source. This can arise when datagrams are waiting to be received in the socket's receive buffer.
|
channel | back to summary |
---|---|
public abstract MulticastChannel channel() Returns the channel for which this membership key was created. This
method will continue to return the channel even after the membership
becomes
|
drop | back to summary |
---|---|
public abstract void drop() Drop membership. If the membership key represents a membership to receive all datagrams then the membership is dropped and the channel will no longer receive any datagrams sent to the group. If the membership key is source-specific then the channel will no longer receive datagrams sent to the group from that source address. After membership is dropped it may still be possible to receive
datagrams sent to the group. This can arise when datagrams are waiting to
be received in the socket's receive buffer. After membership is dropped
then the channel may Upon return, this membership object will be |
group | back to summary |
---|---|
public abstract InetAddress group() Returns the multicast group for which this membership key was created.
This method will continue to return the group even after the membership
becomes
|
isValid | back to summary |
---|---|
public abstract boolean isValid() Tells whether or not this membership is valid. A multicast group membership is valid upon creation and remains
valid until the membership is dropped by invoking the
|
networkInterface | back to summary |
---|---|
public abstract NetworkInterface networkInterface() Returns the network interface for which this membership key was created.
This method will continue to return the network interface even after the
membership becomes
|
sourceAddress | back to summary |
---|---|
public abstract InetAddress sourceAddress() Returns the source address if this membership key is source-specific,
or
|
unblock | back to summary |
---|---|
public abstract MembershipKey unblock(InetAddress source) Unblock multicast datagrams from the given source address that was
previously blocked using the
|