| java.lang.Object | ||
| ↳ | java.net.DatagramSocket | |
| ↳ | java.net.MulticastSocket | |
This class models a multicast socket for sending & receiving datagram packets to a multicast group.
| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Constructs a multicast socket, bound to any available port on the
localhost.
| |||||||||||
Returns a multicast socket, bound to the nominated port on the localhost.
| |||||||||||
Constructs a MulticastSocket bound to the host/port specified by the
SocketAddress, or an unbound DatagramSocket if the SocketAddress is null.
| |||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Answer the network address used by the socket.
| |||||||||||
Get the state of the IP_MULTICAST_LOOP socket option.
| |||||||||||
Answer the network interface used by the socket.
| |||||||||||
This method is deprecated.
Replaced by getTimeToLive()
| |||||||||||
Answer the time-to-live (TTL) for multicast packets sent on this socket.
| |||||||||||
Add this socket to the multicast group.
| |||||||||||
Add this socket to the multicast group.
| |||||||||||
Remove the socket from the multicast group.
| |||||||||||
Remove the socket from the multicast group.
| |||||||||||
This method is deprecated.
use setTimeToLive(int)
| |||||||||||
Set the network address used by the socket.
| |||||||||||
Set the IP_MULTICAST_LOOP socket option.
| |||||||||||
Set the network interface used by the socket.
| |||||||||||
This method is deprecated.
Replaced by setTimeToLive(int)
| |||||||||||
Set the time-to-live (TTL) for multicast packets sent on this socket.
| |||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class java.net.DatagramSocket
| |||||||||||
From class java.lang.Object
| |||||||||||
Constructs a multicast socket, bound to any available port on the localhost.
| IOException | if a problem occurs creating or binding the socket |
|---|
Returns a multicast socket, bound to the nominated port on the localhost.
| aPort | the port to bind on the localhost |
|---|
| IOException | if a problem occurs creating or binding the socket |
|---|
Constructs a MulticastSocket bound to the host/port specified by the SocketAddress, or an unbound DatagramSocket if the SocketAddress is null.
| localAddr | the local machine address and port to bind to |
|---|
| IllegalArgumentException | if the SocketAddress is not supported |
|---|---|
| IOException | if a problem occurs creating or binding the socket |
Answer the network address used by the socket. This is useful on multi-homed machines.
| SocketException | The exception thrown while getting the address |
|---|
Get the state of the IP_MULTICAST_LOOP socket option.
true if the IP_MULTICAST_LOOP is enabled,
false otherwise.| SocketException | if the socket is closed or the option is invalid. |
|---|
Answer the network interface used by the socket. This is useful on multi-homed machines.
| SocketException | The exception thrown while getting the address |
|---|
This method is deprecated.Replaced by getTimeToLive()
Answer the time-to-live (TTL) for multicast packets sent on this socket.
| IOException | The exception description. |
|---|
Answer the time-to-live (TTL) for multicast packets sent on this socket.
| IOException | The exception description. |
|---|
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.
| groupAddr | the multicast group to be joined |
|---|
| IOException | may be thrown while joining a group |
|---|
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.
| groupAddress | the multicast group to be joined |
|---|---|
| netInterface | the network interface on which the addresses should be dropped |
| IOException | will be thrown if address is not a multicast address |
|---|---|
| SecurityException | will be thrown if caller is not authorized to join group |
| IllegalArgumentException | will be through if groupAddr is null |
Remove the socket from the multicast group.
| groupAddr | the multicast group to be left |
|---|
| IOException | will be thrown if address is not a multicast address |
|---|---|
| SecurityException | will be thrown if caller is not authorized to join group |
| IllegalArgumentException | will be through if groupAddr is null |
Remove the socket from the multicast group.
| groupAddress | the multicast group to be left |
|---|---|
| netInterface | the network interface on which the addresses should be dropped |
| IOException | will be thrown if address is not a multicast address |
|---|---|
| SecurityException | will be thrown if caller is not authorized to join group |
| IllegalArgumentException | will be through if groupAddr is null |
This method is deprecated.use setTimeToLive(int)
Send the packet on this socket. The packet must satisfy the security policy before it may be sent.
| pack | the DatagramPacket to send |
|---|---|
| ttl | the TTL setting for this transmission, overriding the socket default |
| IOException | If a send error occurs. |
|---|
Set the network address used by the socket. This is useful on multi-homed machines.
| addr | java.net.InetAddress the interface network address |
|---|
| SocketException | the exception may be thrown while setting the address |
|---|
Set the IP_MULTICAST_LOOP socket option.
| loop | the socket IP_MULTICAST_LOOP option setting |
|---|
| SocketException | if the socket is closed or the option is invalid. |
|---|
Set the network interface used by the socket. This is useful on multi-homed machines.
| netInterface | NetworkInterface the interface to be used |
|---|
| SocketException | the exception may be thrown while setting the address |
|---|
This method is deprecated.Replaced by setTimeToLive(int)
Set the time-to-live (TTL) for multicast packets sent on this socket.
| ttl | the time-to-live, 0 |
|---|
| IOException | The exception thrown while setting the TTL |
|---|
Set the time-to-live (TTL) for multicast packets sent on this socket.
| ttl | the time-to-live, 0<=ttl<= 255 |
|---|
| IOException | The exception thrown while setting the TTL |
|---|