Multicast over TCP/IP HOWTO
Multicast is a method of distributing data over a network in an efficient way. Multicast allows a server to send a single data stream to a local multicast capable router which then redistributes it to other local hosts.
To serve a data stream to multiple clients, a server must choose one of three accepted methods: unicast, broadcast, or multicast. Unicast requires a unique connection between the server and each client. Broadcast floods non-client machines with packets they must discard, reducing network performance. Broadcast will also only work well over a single LAN. Multicast is a solution because it allows a broadcast-like packet spread over a well known channel originating over a LAN from a local source. The number of unique connections required of the server is thus dramatically reduced.
Multicast clients are required to contact their local multicast router and 'join' or request a connection to a multicast channel or group.
Multicast addresses could be considered Class D addresses. They cover the address range: 22.214.171.124 - 126.96.36.199.
There are several defined multicast addresses that are used for specific purposes.
188.8.131.52 is reserved as the 'all-hosts' group. If you ping that group, all multicast capable hosts on the network should answer as every Multicast capable host must join that group at start-up.
184.108.40.206 is reserved as the 'all-routers' group. All multicast routers must join this group on all its multicast capable interfaces.
Other addresses are also reserved and the list grows as more support is developed to meet the growing needs of the installed base. They are regularly published in the 'Assigned Numbers' RFCs.
There are currently three defined conformance levels:
Multicast packets are sent via UDP. In principle, an application needs only to open a UDP socket to a multicast address. In practice, however, there are additional opearations that a sending process must be able to control, including TTL (Time To Live) and Loopback. TTL is used for specific purposes in multicast.
TTL is used in normal traffic as a method of limiting the number of hopps a datagram must traverse. Each router decrements the value of the TTL by a threshold value as it is routed and drops the packet when TTL reaches 0. With multicast, however, TTL is used as a threshold. The main difference is that when a datagram traverses a router with certain threshold assignments, the datagram's TTL is not decremented by the threshold, only by 1.
Ask the kernel to 'join' a multicast group. What you are actually doing is asking to join a group on a particular network. You must first ping 220.127.116.11 and find a multicast capable router to connect to. Then bind to the port and receive the packets as normal.
Normally you would just close the port, but with multicast, you must inform the kernel that you are no longer interested in receiving multicast traffic from a specific channel. The kernel then finds out if any other processes are interested in that channel before closing the connection. A connection to a multicast channel is on a per-host membership and not per-process.
MBone is a Multicast Backbone or virtual multicast network based on multicast islands connected by multicast tunnels. This allows servers from non complient networks to wrap multicast data within a unicast packet to multicast islands where they are unwrapped and multicast throughout the MBone network.
Copyright © 1998 Larry Smithmier