mdw.nbio
クラス NonblockingMulticastSocket

java.lang.Object
  |
  +--java.net.DatagramSocket
        |
        +--mdw.nbio.NonblockingDatagramSocket
              |
              +--mdw.nbio.NonblockingMulticastSocket
すべての実装インタフェース:
Selectable

public class NonblockingMulticastSocket
extends NonblockingDatagramSocket

NonblockingMulticastSocket provides non-blocking multicast datagram I/O. NOTE: packets cannot be received on a socket once connect() is called, due to the semantics of connect() for multicast sockets. Instead, applications should generally use joinGroup(), and then explicitly specify the group address as the destination in all the outbound packets.


インタフェース mdw.nbio.Selectable から継承したフィールド
ACCEPT_READY, CONNECT_READY, READ_READY, SELECT_ERROR, WRITE_READY
 
コンストラクタの概要
NonblockingMulticastSocket()
          Create a NonblockingMulticastSocket bound to any available port.
NonblockingMulticastSocket(int port)
           
NonblockingMulticastSocket(int port, java.net.InetAddress laddr)
          Create a NonblockingMulticastSocket bound to the given port and the given local address.
 
メソッドの概要
 java.net.InetAddress getInterface()
          Get the interface associated with this multicast socket
 int getTimeToLive()
          get the multicast ttl
 void joinGroup(java.net.InetAddress addr)
          Join a multicast group
 void leaveGroup(java.net.InetAddress addr)
          Leave a multicast group
 void seeLocalMessages(boolean state)
          This sets the state of the IP_MULTICAST_LOOP option on the underlying socket.
 void setInterface(java.net.InetAddress addr)
          Set the interface associated with this socket
 void setTimeToLive(int ttl)
          set the time to live
 
クラス mdw.nbio.NonblockingDatagramSocket から継承したメソッド
close, connect, connect, disconnect, getInetAddress, getLocalAddress, getLocalPort, getPort, getReceiveBufferSize, getSendBufferSize, nbReceive, nbReceive, nbSend, nbSend, nbSend, receive, send, setReceiveBufferSize, setSendBufferSize
 
クラス java.net.DatagramSocket から継承したメソッド
getSoTimeout, setDatagramSocketImplFactory, setSoTimeout
 
クラス java.lang.Object から継承したメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

コンストラクタの詳細

NonblockingMulticastSocket

public NonblockingMulticastSocket()
                           throws java.io.IOException
Create a NonblockingMulticastSocket bound to any available port.

NonblockingMulticastSocket

public NonblockingMulticastSocket(int port)
                           throws java.io.IOException

NonblockingMulticastSocket

public NonblockingMulticastSocket(int port,
                                  java.net.InetAddress laddr)
                           throws java.io.IOException
Create a NonblockingMulticastSocket bound to the given port and the given local address.
メソッドの詳細

joinGroup

public void joinGroup(java.net.InetAddress addr)
               throws java.io.IOException
Join a multicast group

leaveGroup

public void leaveGroup(java.net.InetAddress addr)
                throws java.io.IOException
Leave a multicast group

getTimeToLive

public int getTimeToLive()
                  throws java.io.IOException
get the multicast ttl

setTimeToLive

public void setTimeToLive(int ttl)
                   throws java.io.IOException
set the time to live

getInterface

public java.net.InetAddress getInterface()
Get the interface associated with this multicast socket

setInterface

public void setInterface(java.net.InetAddress addr)
                  throws java.io.IOException
Set the interface associated with this socket

seeLocalMessages

public void seeLocalMessages(boolean state)
                      throws java.io.IOException
This sets the state of the IP_MULTICAST_LOOP option on the underlying socket. If state==true, the socket will receive packets it sends out. If false, it will not.

NOTE: The behavior of this is somewhat strange for two multicast listeners on the same physical machine. Ideally, this should be an incoming filter - each socket should throw out packets that it sent out, and not deliver them to the application.

Unfortunately, this instead seems to be an outbound filter - all packets sent out on a socket with IP_MULTICAST_LOOP turned off will be invisible to all sockets on the local machine - regardless of whether or not these other sockets have specified IP_MULTICAST_LOOP=false.