Distributed Systems Distributed Systems: Multicast Communication Multicast Communication
Distributed Systems Distributed Systems: Multicast Communication Multicast Communication
Multicast Communication
Unicast,Multicast,Broadcast
v 1.0
Why Multicast?
v 1.0
What Can Multicast Be Useful for?
Multicast messages provides a useful infrastructure for constructing
distributed systems with the following characteristics:
Fault tolerance based on replicated services:
• A replicated service consists of a group of members.
• Client requests are multicast to all the members of the group,
each of which performs an identical operation.
• Even when some of the members fail, clients can still be served.
v 1.0
What Can Multicast Be Useful for?
v 1.0
What Can Multicast Be Useful for?
v 1.0
IP Multicast
• IP multicast is built on top of the Internet Protocol, IP.
• Note that IP packets are addressed to computers - ports
belong to the TCP and UDP levels.
• IP multicast allows the sender to transmit a single IP packet to
a set of computers that form a multicast group.
• The sender is unaware of the identities of the individual
recipients and of the size of the group.
v 1.0
IP Multicast
• Being a member of a multicast group allows a computer to receive
IP packets sent to the group.
• The membership of multicast groups is dynamic, allowing
computers to join or leave at any time and to join an arbitrary
number of groups.
• It is possible to send datagrams to a multicast group without being
a member.
v 1.0
IP Multicast - Programming Level
• At the application programming level, IP multicast is available
only via UDP.
• An application program performs multicasts by sending UDP
datagrams with multicast addresses and ordinary port numbers.
• An application program can join a multicast group by making its
socket join the group, enabling it to receive messages to the
group.
v 1.0
IP Multicast - IP Level
At the IP level:
• A computer belongs to a multicast group when one or more of its
processes has sockets that belong to that group.
• When a multicast message arrives at a computer:
copies are forwarded to all of the local sockets that
have joined the specified multicast address and are bound to the
specified port number.
v 1.0
Multicast Address Allocation
• Multicast addresses are dynamically assigned.
• An IP datagram sent to a multicast address is forwarded to
everyone who has joined the multicast group
• If an application is terminated, the multicast address is
(implicitly) released.
• A multicast group is specified by an Internet address whose first
4 bits are 1110 (in IPv4).
v 1.0
IGMP
• Dynamically registers individual hosts in a multicast group on a
particular LAN.
• Hosts identify group memberships by sending IGMP messages
to their local multicast router.
v 1.0
JAVA API for IP Multicast
The Class MulticastSocket
The Java API provides a datagram interface to IP multicast through the
class MulticastSocket.
A subclass of DatagramSocket with the additional capability of being
able to join multicast groups.
It provides two alternative constructors, allowing sockets to be created
to use either a specified local port or any free local port.
v 1.0
Joining a Group
• A process can join a group with a given multicast address by invoking
the joinGroup method of its multicast socket.
• In this way, the socket joins a multicast group at a given port and it will
receive datagrams sent by processes on other computers to that
group at that port.
• A process can leave a specified group by invoking the leaveGroup
method of its multicast socket.
v 1.0
Leaving a Group
v 1.0
EXAMPLE
Multicast Peer Joins a Group and Sends and
Receives Datagrams
• When several instances of this program are run simultaneously
on different computers, all of them join the same group and
each of them should receive its own message and the
messages from that joined after it.
v 1.0
v 1.0
THANK YOU!