java.net.MulticastSocket
The multicast datagram socket class is useful for sending and receiving IP multicast packets. A MulticastSocket is a (UDP) DatagramSocket, with additional capabilities for joining "groups" of other multicast hosts on the internet.
A multicast group is specified by a class D IP address and by a standard UDP port number. Class D IP addresses are in the range of 224.0.0.0 to 239.255.255.255, inclusive. The address 224.0.0.0 is reserved and should not be used.
Some methods of MulticastSocket class
MulticastSocket(): This method constructs a multicast socket and binds it to any available port on the local host machine.
MulticastSocket(int): This method constructs a multicast socket and binds it to the specified port on the local host machine.
MulticastSocket(SocketAddress): This method creates a multicast socket, bound to the specified local socket address.
getNetworkInterface(): This method gets the multicast network interface set.
getTimeToLive(): This method gets the default time-to-live for multicast packets sent out on the socket.
joinGroup(SocketAddress, NetworkInterface): This method joins the specified multicast group at the specified interface.
leaveGroup(SocketAddress, NetworkInterface): This method leaves a multicast group on a specified local interface.
setNetworkInterface(NetworkInterface): This method specifies the network interface for outgoing multicast datagrams sent on this socket.
setTimeToLive(int): This method sets the default time-to-live for multicast packets sent out to this MulticastSocket in order to control the scope of the multicast.
No comments:
Post a Comment