java.net
public class MulticastSocket extends DatagramSocket
Please note that applets are not allowed to use multicast sockets Written using on-line Java Platform 1.2 API Specification, as well as "The Java Class Libraries", 2nd edition (Addison-Wesley, 1998). Status: Believed complete and correct.
Since: 1.1
UNKNOWN: May 18, 1999.
Constructor Summary | |
---|---|
MulticastSocket()
Create a MulticastSocket that this not bound to any address
| |
MulticastSocket(int port)
Create a multicast socket bound to the specified port
| |
MulticastSocket(SocketAddress address)
Create a multicast socket bound to the specified SocketAddress.
|
Method Summary | |
---|---|
InetAddress | getInterface()
Returns the interface being used for multicast packets
|
boolean | getLoopbackMode()
Checks if local loopback mode is enabled
|
NetworkInterface | getNetworkInterface()
Gets the local network interface which is used to send multicast messages
|
int | getTimeToLive()
Returns the current value of the "Time to Live" option. |
byte | getTTL()
Returns the current value of the "Time to Live" option. |
void | joinGroup(InetAddress mcastaddr)
Joins the specified multicast group.
|
void | joinGroup(SocketAddress mcastaddr, NetworkInterface netIf)
Joins the specified mulitcast group on a specified interface.
|
void | leaveGroup(InetAddress mcastaddr)
Leaves the specified multicast group
|
void | leaveGroup(SocketAddress mcastaddr, NetworkInterface netIf)
Leaves the specified mulitcast group on a specified interface.
|
void | send(DatagramPacket packet, byte ttl)
Sends a packet of data to a multicast address with a TTL that is
different from the default TTL on this socket. |
void | setInterface(InetAddress addr)
Sets the interface to use for sending multicast packets.
|
void | setLoopbackMode(boolean disable)
Disable/Enable local loopback of multicast packets. |
void | setNetworkInterface(NetworkInterface netIf)
Sets the local network interface used to send multicast messages
|
void | setTimeToLive(int ttl)
Sets the "Time to Live" value for a socket. |
void | setTTL(byte ttl)
Sets the "Time to Live" value for a socket. |
Throws: IOException If an error occurs SecurityException If a security manager exists and its checkListen method doesn't allow the operation
Parameters: port The port to bind to
Throws: IOException If an error occurs SecurityException If a security manager exists and its checkListen method doesn't allow the operation
Parameters: address The SocketAddress the multicast socket will be bound to
Throws: IOException If an error occurs SecurityException If a security manager exists and its checkListen method doesn't allow the operation
Since: 1.4
Returns: The multicast interface
Throws: SocketException If an error occurs
Returns: true if loopback mode is enabled, false otherwise
Throws: SocketException If an error occurs
Since: 1.4
Returns: The local network interface to send multicast messages
Throws: SocketException If an error occurs
Since: 1.4
Returns: The TTL value
Throws: IOException If an error occurs
Since: 1.2
Deprecated: 1.2 Replaced by getTimeToLive()
Returns the current value of the "Time to Live" option. This is the number of hops a packet can make before it "expires". This method id deprecated. UsegetTimeToLive
instead.
Returns: The TTL value
Throws: IOException If an error occurs
See Also: getTimeToLive
Parameters: mcastaddr The address of the group to join
Throws: IOException If an error occurs SecurityException If a security manager exists and its checkMulticast method doesn't allow the operation
Parameters: mcastaddr The multicast address to join netIf The local network interface to receive the multicast messages on or null to defer the interface set by #setInterface or #setNetworkInterface
Throws: IOException If an error occurs IllegalArgumentException If address type is not supported SecurityException If a security manager exists and its checkMulticast method doesn't allow the operation
Since: 1.4
See Also: MulticastSocket
Parameters: mcastaddr The address of the group to leave
Throws: IOException If an error occurs SecurityException If a security manager exists and its checkMulticast method doesn't allow the operation
Parameters: mcastaddr The multicast address to leave netIf The local networki interface or null to defer to the interface set by setInterface or setNetworkInterface
Throws: IOException If an error occurs IllegalArgumentException If address type is not supported SecurityException If a security manager exists and its checkMulticast method doesn't allow the operation
Since: 1.4
See Also: MulticastSocket
Deprecated:
Sends a packet of data to a multicast address with a TTL that is different from the default TTL on this socket. The default TTL for the socket is not changed.Parameters: packet The packet of data to send ttl The TTL for this packet
Throws: IOException If an error occurs SecurityException If a security manager exists and its checkConnect or checkMulticast method doesn't allow the operation
Parameters: addr The new interface to use.
Throws: SocketException If an error occurs.
Since: 1.4
Parameters: disable True to disable loopback mode
Throws: SocketException If an error occurs
Since: 1.4
Parameters: netIf The local network interface used to send multicast messages
Throws: SocketException If an error occurs
Since: 1.4
Parameters: ttl The new TTL value
Throws: IOException If an error occurs
Since: 1.2
Deprecated: 1.2 Replaced by setTimeToLive
Parameters: ttl The new TTL value
Throws: IOException If an error occurs
See Also: MulticastSocket