All Packages Class Hierarchy This Package Previous Next Index
Class java.net.MulticastSocket
java.lang.Object
|
+----java.net.DatagramSocket
|
+----java.net.MulticastSocket
- public final class MulticastSocket
- extends DatagramSocket
The multicast datagram socket class is useful for sending
and receiving IP multicast.
Currently applets are not allowed ot use multicast sockets.
-
MulticastSocket()
- Create a multicast socket.
-
MulticastSocket(int)
- Create a multicast socket and bind it to a specific port.
-
getInterface()
- Retrieve the address of the network interface used for
multicast packets.
-
joinGroup(InetAddress)
- Joins a multicast group.
-
leaveGroup(InetAddress)
- Leave a multicast group.
-
send(DatagramPacket, byte)
- Sends a datagram packet to the destination
-
setInterface(InetAddress)
- Set the outgoing network interface for multicast packets on this
socket, to other than the system default.
MulticastSocket
public MulticastSocket() throws IOException
- Create a multicast socket.
MulticastSocket
public MulticastSocket(int port) throws IOException
- Create a multicast socket and bind it to a specific port.
- Parameters:
- local - port to use
joinGroup
public void joinGroup(InetAddress mcastaddr) throws IOException
- Joins a multicast group.
- Parameters:
- mcastaddr - is the multicast address to join
- Throws: IOException
- is raised if there is an error joining
or when address is not a multicast address.
leaveGroup
public void leaveGroup(InetAddress mcastaddr) throws IOException
- Leave a multicast group.
- Parameters:
- mcastaddr - is the multicast address to leave
- Throws: IOException
- is raised if there is an error leaving
or when address is not a multicast address.
setInterface
public void setInterface(InetAddress inf) throws SocketException
- Set the outgoing network interface for multicast packets on this
socket, to other than the system default. Useful for multihomed
hosts.
getInterface
public InetAddress getInterface() throws SocketException
- Retrieve the address of the network interface used for
multicast packets.
send
public synchronized void send(DatagramPacket p,
byte ttl) throws IOException
- Sends a datagram packet to the destination
- Parameters:
- p - is the packet to be sent. The packet should contain
the destination multicast ip address and the data to be sent.
One does not need to be the member of the group to send
packets to a destination multicast address.
- ttl - optional time to live for multicast packet.
default ttl is 1.
- Throws: IOException
- is raised if an error occurs i.e
error while setting ttl.
- See Also:
- send, receive
All Packages Class Hierarchy This Package Previous Next Index