Download presentation
Presentation is loading. Please wait.
1
Chapter 9: Multicast Sockets
Network Programming Chapter 9: Multicast Sockets
2
Agenda Unicasts, Broadcasts, Multicasts
Application Models with Multicasting Architecture of Multicast Sockets Using Multicast Sockets with .NET Creating a Chat Application Creating a Picture Show Application
3
Introduction Multicasts can be used for group communications over the Internet, where every node participating in the multicast must join the group set up for the purpose In multicasts, a sender sends a message to a GROUP of receivers (group distribution) Broadcasts may be achieved via UDP Multicasts may be achieved via UDP
4
Unicasts, Broadcasts and Multicasts
Introduction IP Protocol supports Unicast Broadcast Multicast Unicast addresses Broadcast addresses Multicast addresses
5
Unicasts, Broadcasts and Multicasts
Introduction Unicast addresses Network packets sent to a single destination Server maintains a separate connection for each client TCP can only send unicast messages UDP can send unicast messages (no reliability checks) Broadcast addresses Multicast addresses
6
Unicasts, Broadcasts and Multicasts
Introduction Unicast addresses Broadcast addresses Broadcast datagrams are sent to all nodes in a subnetwork Broadcasts always use UDP Low overheads No guarantee that message has been received Broadcasts don’t cross subnets Multicast addresses
7
Unicasts, Broadcasts and Multicasts
Introduction Unicast addresses Broadcast addresses Multicast addresses Multicast datagrams are sent to every node that belongs to a group (regardless of subnet) Every host (node) that wants to receive multicast messages must register with the Internet Group Management Protocol (IGMP) Class D addresses ( to ) are used for multicast gateways
8
Agenda Unicasts, Broadcasts, Multicasts
Application Models with Multicasting Architecture of Multicast Sockets Using Multicast Sockets with .NET Creating a Chat Application Creating a Picture Show Application
9
Application Models with Multicasting
Chat server/client Many-to-Many Applications Allows every system in a group to send data to every other system in the group A multicast can be used E.g. a peer-to-peer chat system (everyone in the group can see what everyone else is saying) One-to-Many Applications Chat server/client Chat server/client Chat server/client Chat server/client
10
Application Models with Multicasting
Many-to-Many Applications One-to-Many Applications One system may send a message to a group of systems This can be useful for video, audio or other large files/data types Sender Receiver Receiver Receiver Receiver Receiver
11
Agenda Unicasts, Broadcasts, Multicasts
Application Models with Multicasting Architecture of Multicast Sockets Using Multicast Sockets with .NET Creating a Chat Application Creating a Picture Show Application
12
Architecture of Multicast Sockets
Introduction Multicast messages send using UDP and class D addresses Can also use IGMP to send multicast messages IGMP Multicast Address Allocation Routing Scoping Routing Protocols Scalability Reliability Security
13
IGMP Part of IP module and allows clients to leave a group as well as join a group IGMP = Internet Group Management Protocol IGMP messages are encapsulated in IP datagrams with the IP protocol number 2. Versions of IGMP IGMP version 2 (IGMPv2): client can explicitly leave the group (and almost immediately) IGMP version 3 (IGMPv3): RFC 3376 – ) Allows specific joins and leaves with the source address(es). Possible now to run Source-Specific Multicast (SSM) protocol.
14
IGMPv3 Message Format 8-Bit Type 8-Bit Max Response Time
16-Bit Checksum 32-Bit Group Address Reserved S QRV QQIC Number of Sources Source Address 1 Source Address 2 Source Address 3 The IGMPv3 message adds a varying number of 32-bit values to the message. The 32 bits that follow the group address are separated as follows: A 4-bit reserved field A 1-bit S flag that defines that the router should suppress updating the time field A 3-bit QRV (Querier’s Robustness Variable) that defines the robustness value of the sender of the query An 8-bit QQIC (Querier’s Query Interval Code) value that specifies the number of seconds of the query interval A 16-bit number that defines the number of source addresses that continue with the following bytes of the message
15
IGMP Message Header Hex Value Message Description 0x11
Membership Query These are used by the router to see whether any group members exist. Two types of membership queries can be differentiated by the group address in the 32-bit group address field. A general query has a group address in the ICMP header of all zeros, and asks which groups have members on an attached network. A group-specific query returns information about whether a particular group has members 0x22 Version 3 Membership Report When a host joins a multicast group, a membership report is sent to the router to inform the router that a system on the network is listening to multicast messages. The values for IGMPv1 and v2 membership reports are 0x12 and 0x16. IGMPv3 implementations must also understand membership reports for IGMPv1 and IGMPv2 0x17 Leave Group The last host of a multicast group inside a subnet must send a leave group message to all routers ( ) when it leaves a group. A host may remember the hosts of the multicast group (received in membership reports in response t o membership queries), so that it knows when it is the last one in the grup, but this is not a requirement. If the group members are not remembered, every host leaving a group sends a leave group message. In any case, the router checks if it was the last host in the group, and stops forwarding multicast messages if so.
16
Multicast Address Allocation
Class D address range to Special purpose range: to (cannot be used and routers will not pass these messages on) RFC 3171 defines the use of specific ranges of IP multicast addresses and their purposes Ways in which addresses can be allocated: Static Dynamic Scope-relative
17
Multicast Address Allocation
Static Multicast Addresses Usually are globally assigned by the IANA Usually for messages that are of global interest Used for protocols that need well-known addresses IANA-assigned addresses may be hard-coded into applications and devices Two blocks of static multicast addresses are used: Local Network Control Block Internetwork Control Block Dynamic Multicast Addresses Scope-Relative Multicast Addresses IANA = Internet Assigned Numbers Authority Local Network control Block: This includes all systems on the subnet. Addresses starting with belong to this block, and they are never forwarded by a router. Examples of these are to send a message to all systems on the subnet and to send a message to all routers on a subnet. They Dynamic Host Configuration Protocol (DHCP) server answers messages on the IP address , but only on a subnet Internetwork Control Block: The addresses in the CIDR range /24 belong to this block. Messages sent to these addresses can be forwarded by a router. Examples are Network Time Protocol (NTP) and Windows Internet Name Service (WINS) requests. CIDR = Classless Inter-Domain Routing
18
Multicast Address Allocation
Static Multicast Addresses Dynamic Multicast Addresses Often better suited to circumstances than static address Request-on-demand addresses have a “life-time” Similar concept to DHCP Multicast Address Dynamic Client Allocation Protocol (MADCAP) MADCAP: the client sends a unicast or multicast message out to a MADCAP server to request a multicast address. The server answers with a lease-based address Scope-Relative Multicast Addresses
19
Multicast Address Allocation
Static Multicast Addresses Dynamic Multicast Addresses Scope-Relative Multicast Addresses Multicast addresses that are only used within a local group or organisation Address range to is reserved for administrative scope-relative addresses. (These addresses can be reused with other local groups because the routers filter this address range out and prevent the message from leaving the local network)
20
Architecture of Multicast Sockets
Introduction Multicast messages send using UDP and class D addresses Can also use IGMP to send multicast messages IGMP Multicast Address Allocation Routing Scoping Routing Protocols Scalability Reliability Security
21
Routing Multicast backbone (MBone)
Routers don’t necessarily implement multicasting (manufacturing issue) Multicasting over the Internet Multicast messages forwarded using unicast connections MBone tools are available MBone used for audio and video multicasts, technical talks, seminars, NASA space shuttle missions, etc
22
Scoping Done via Class D addresses (issued by IANA) TTL = 1
Message does not leave the network Each router that receives the group report decrements the TTL by 1
23
Routing Protocols Distance Vector Multicast Routing Protocol (DVMRP): uses a reverse path-flooding algorithm, where the router sends a copy of the network packet out to all paths, except the one from which the packet originated. If no node in a router’s network is a member of the multicast group, the router sends a prune message back to the sending router so that it knows it does not need to receive packets for that multicast group. DVMRP periodically refloods attached networks to reach new nodes that may be added to the multicast group. DVMRP does not scale very well. Multicast Open Shortest Path First (MOSPF) Protocol-Independent Multicast (PIM)
24
Routing Protocols Distance Vector Multicast Routing Protocol (DVMRP)
Multicast Open Shortest Path First (MOSPF): This protocol is an extension of the Open Shortest Path First (OSPF) Protocol. With MOSPF, all routers must be aware of all available links to networks hosting members of multicast groups. MOSPF calculates routes when multicast traffic is received. This protocol can be used only in networks where OSPF is used as a unicast routing protocol, because MOSPF routes are exchanged between routers using OSPF. MOSPF does not scale well if many multicast groups are used or if groups change often. Protocol-Independent Multicast (PIM)
25
Routing Protocols Distance Vector Multicast Routing Protocol (DVMRP)
Multicast Open Shortest Path First (MOSPF) Protocol-Independent Multicast (PIM): This protocol uses two different algorithms for sending messages to group members. When the members are widely distributed across different networks, PIM-SM (Sparse Mode) is employed; when a group uses only a few networks, PIM-DM (Dense Mode) is used. PIM-DM uses a reverse path-flooding algorithm similar to DVMRP, except that any unicast routing protocol can be used. PIM-SM defines a registration point for proper routing of packets.
26
Architecture of Multicast Sockets
Introduction Multicast messages send using UDP and class D addresses Can also use IGMP to send multicast messages IGMP Multicast Address Allocation Routing Scoping Routing Protocols Scalability Reliability Security
27
Scalability It is an advantage of multicasting
Multicasting is the most efficient and scalable way to send messages to multiple clients Broadcasting has the disadvantage that messages cannot cross networks and that clients who are not interested pick up the broadcast as well.
28
Reliability IP multicasting does not offer any compatible transport-level protocol that is both reliable and implements a flow mechanism UDP offers no guarantees Sometimes need a highly reliable mechanism for transporting packets (e.g. multicasting an application to several workstations simultaneously) If guaranteed delivery is needed, then must use custom handshaking using a reliable protocol Add packet numbers Add a checksum If the receiver detects a corrupted message, it sends a NACK message to the sender NACK = Negative Acknowledgement
29
Security Multicasting security
Internet multicasting vs Intranet multicasting Firewall prevents “leaks” into Internet Clients need to register with group Internet Engineering Task Force (IETF) working group working on Multicast Security (MSEC) proposal Multicast Group Key management
30
Agenda Unicasts, Broadcasts, Multicasts
Application Models with Multicasting Architecture of Multicast Sockets Using Multicast Sockets with .NET Creating a Chat Application Creating a Picture Show Application
31
Using Multicast Sockets with .NET
Multicast Sender Applications No special tasks Use the UdpClient class Use a multicast address IPEndPoint object, remoteEP, will point to the group address and the port number that will be used by the group Multicast address must be known to clients joining the group Can use a MADCAP server to get addresses dynamically Use a stream socket that the client connects to, to tell the client about the multicast address Multicast Receiver Applications
32
Using Multicast Sockets with .NET
Multicast Sender Applications Multicast Receiver Applications Using the UdpClient Class Need to program UdpClient Class Clients must join the multicast group Need to be able to drop a group member Using the Socket Class May use the Socket class instead of UdpClient class A UDP socket is created (AddMembership and MulticastTimeToLive are programmable options) IGMP protocol is implemented
33
Agenda Unicasts, Broadcasts, Multicasts
Application Models with Multicasting Architecture of Multicast Sockets Using Multicast Sockets with .NET Creating a Chat Application Creating a Picture Show Application
34
Creating a Chat Application
Setting Up the User Interface Creating the Configuration File Joining the Multicast Group Receiving Multicast Messages Sending Multicast Messages Starting the Chat Application
35
Agenda Unicasts, Broadcasts, Multicasts
Application Models with Multicasting Architecture of Multicast Sockets Using Multicast Sockets with .NET Creating a Chat Application Creating a Picture Show Application
36
Creating a Picture Show Application
Creating a Picture Protocol Building the Picture Show Server Creating the Picture Show Client Starting the Picture Show
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.