java.net.MulticastSocket (JDK 1.1)
This subclass of DatagramSocket is used to send and receive multicast UDP packets. It extends DatagramSocket by adding joinGroup() and leaveGroup() methods to join and leave multicast groups. The IP address specified to these methods should be a valid multicast address in the range of 224.0.0.1 to 239.255.255.255. Note that you do not have to join a group to send a packet to a multicast address, but you must join the group to receive packets sent to that address.
MulticastSocket defines a variant send() method that allows you to specify a time-to-live (TTL) value for the packet you send. This value specifies the number of network "hops" the packet may travel before it expires. You can also set a default TTL for all packets sent though a MulticastSocket with setTTL().
Note that untrusted applets are not allowed to use multicast sockets.
public classMulticastSocketextends DatagramSocket { //Public ConstructorspublicMulticastSocket() throws IOException; publicMulticastSocket(intport) throws IOException; //Public Instance Methodspublic InetAddressgetInterface() throws SocketException; public bytegetTTL() throws IOException; public voidjoinGroup(InetAddressmcastaddr) throws IOException; public voidleaveGroup(InetAddressmcastaddr) throws IOException; public synchronized voidsend(DatagramPacketp, bytettl) throws IOException; public voidsetInterface(InetAddressinf) throws SocketException; public voidsetTTL(bytettl) throws IOException; }
Hierarchy:
Object->DatagramSocket->MulticastSocket