| |
|
| java.lang.Object java.net.DatagramSocket java.net.MulticastSocket
MulticastSocket | public class MulticastSocket extends DatagramSocket (Code) | | This class models a multicast socket for sending & receiving datagram packets
to a multicast group.
See Also: DatagramSocket |
Constructor Summary | |
public | MulticastSocket() Constructs a multicast socket, bound to any available port on the
localhost. | public | MulticastSocket(int aPort) Answers a multicast socket, bound to the nominated port on the localhost. | public | MulticastSocket(SocketAddress localAddr) Constructs a MulticastSocket bound to the host/port specified by the
SocketAddress, or an unbound DatagramSocket if the SocketAddress is null. |
SO_REUSEPORT | final static int SO_REUSEPORT(Code) | | |
MulticastSocket | public MulticastSocket() throws IOException(Code) | | Constructs a multicast socket, bound to any available port on the
localhost.
throws: IOException - if a problem occurs creating or binding the socket |
MulticastSocket | public MulticastSocket(int aPort) throws IOException(Code) | | Answers a multicast socket, bound to the nominated port on the localhost.
Parameters: aPort - the port to bind on the localhost throws: IOException - if a problem occurs creating or binding the socket |
MulticastSocket | public MulticastSocket(SocketAddress localAddr) throws IOException(Code) | | Constructs a MulticastSocket bound to the host/port specified by the
SocketAddress, or an unbound DatagramSocket if the SocketAddress is null.
Parameters: localAddr - the local machine address and port to bind to throws: IllegalArgumentException - if the SocketAddress is not supported throws: IOException - if a problem occurs creating or binding the socket since: 1.4 |
getInterface | public InetAddress getInterface() throws SocketException(Code) | | Answer the network address used by the socket. This is useful on
multi-homed machines.
java.net.InetAddress the network address exception: java.net.SocketException - The exception thrown while getting the address |
getLoopbackMode | public boolean getLoopbackMode() throws SocketException(Code) | | Get the state of the IP_MULTICAST_LOOP socket option.
true if the IP_MULTICAST_LOOP is enabled,false otherwise. throws: SocketException - if the socket is closed or the option is invalid. since: 1.4 |
getNetworkInterface | public NetworkInterface getNetworkInterface() throws SocketException(Code) | | Answer the network interface used by the socket. This is useful on
multi-homed machines.
java.net.NetworkInterface the network address exception: java.net.SocketException - The exception thrown while getting the address since: 1.4 |
getTimeToLive | public int getTimeToLive() throws IOException(Code) | | Answer the time-to-live (TTL) for multicast packets sent on this socket.
java.net.InetAddress exception: IOException - The exception description. |
joinGroup | public void joinGroup(InetAddress groupAddr) throws IOException(Code) | | Add this socket to the multicast group. A socket must joint a group
before data may be received. A socket may be a member of multiple groups
but may join any group once.
Parameters: groupAddr - the multicast group to be joined exception: IOException - may be thrown while joining a group |
joinGroup | public void joinGroup(SocketAddress groupAddress, NetworkInterface netInterface) throws IOException(Code) | | Add this socket to the multicast group. A socket must join a group before
data may be received. A socket may be a member of multiple groups but may
join any group once.
Parameters: groupAddress - the multicast group to be joined Parameters: netInterface - the network interface on which the addresses should be dropped exception: IOException - will be thrown if address is not a multicast address exception: java.lang.SecurityException - will be thrown if caller is not authorized to join group exception: java.lang.IllegalArgumentException - will be through if groupAddr is null since: 1.4 |
send | public void send(DatagramPacket pack, byte ttl) throws IOException(Code) | | Send the packet on this socket. The packet must satisfy the security
policy before it may be sent.
Parameters: pack - the DatagramPacket to send Parameters: ttl - the TTL setting for this transmission, overriding the socketdefault exception: IOException - If a send error occurs. |
setInterface | public void setInterface(InetAddress addr) throws SocketException(Code) | | Set the network address used by the socket. This is useful on multi-homed
machines.
Parameters: addr - java.net.InetAddress the interface network address exception: java.net.SocketException - the exception may be thrown while setting the address |
setLoopbackMode | public void setLoopbackMode(boolean loop) throws SocketException(Code) | | Set the IP_MULTICAST_LOOP socket option.
Parameters: loop - the socket IP_MULTICAST_LOOP option setting throws: SocketException - if the socket is closed or the option is invalid. since: 1.4 |
setNetworkInterface | public void setNetworkInterface(NetworkInterface netInterface) throws SocketException(Code) | | Set the network interface used by the socket. This is useful on
multi-homed machines.
Parameters: netInterface - NetworkInterface the interface to be used exception: java.net.SocketException - the exception may be thrown while setting the address since: 1.4 |
setTimeToLive | public void setTimeToLive(int ttl) throws IOException(Code) | | Set the time-to-live (TTL) for multicast packets sent on this socket.
Parameters: ttl - the time-to-live, 0<=ttl<= 255 exception: IOException - The exception thrown while setting the TTL |
|
|
|