In a datagram network, Multicast is the transmission of the data packet to the multiple destination. The advantage of multicast is that you can send down its data to a group of hosts sharing a common address. If we are not using Multicast, then we need to send the data packets one for each host.
In order to send any kind of datagram in Java, be it unicast, broadcast or multicast, one needs a java.net.DatagramSocket :
DatagramSocket socket = new DatagramSocket();
The word "Multicast" is typically used to refer to IP Multicast, which is a protocol for efficiently sending to multiple receivers at the same time on TCP/IP networks, by use of a multicast address.
One can optionally supply a local port to the DatagramSocket constructor to which the socket must bind. This is only necessary if one needs other parties to be able to reach us at a specific port. A third constructor takes the local port AND the local IP address to which to bind. This is used (rarely) with multi-homed hosts where it is important on which network adapter the traffic is received.
For more details Click the link below :
Recommend the tutorial
Ask Questions? Discuss: Multicasting in Java - java tutorials,tutorial
Post your Comment