I simplified the TCP/IP/UDP discussion up there a little when I implied that IP (and hence UDP and TCP) would route packets from one device on a network to another device. More accurately, IP routes packets from one IP address to another IP address. The trick with multicasting, or sending the same packets of data at the same time to many devices is that certain IP addresses can be designated as multicast address and assigned to many devices at the same time.
The first thing to know about IP multicasting is that there only exists UDP multicasting. There’s no such thing as TCP multicast. Why not? See, the point of multicast is to be efficient with the network and send the same data packet to as many different, possibly unknown computers. But each TCP connection can potentially require retransmission of different lost packets, or different delays or ordered arrival and assembly of packets. So managing and sending all that for each possible device would be resource-intensive even if it were possible, which would defeat much of the point of using multicast. (And it’s not possible anyway because multicast can’t know where the outbound packets actually wind up.)
Oh, and via back-formation, regular non-multicast UDP (and TCP) messages are called unicast.
The next thing to know is that multicast will often not be sent over a router to another network. There are a few reasons why:
- A low TTL for most multicast packets: All IP packets have a time-to-live, or TTL. Unlike with DNS records, TTL on IP packets refers to the maximum number of network hops that a packet can make to get to its destination. Unicast packets typically are allowed to cross about 30 networks (i.e., get routed by, or “hop”, 29 routers). Getting across the internet rarely takes more than 15 hops, so the limit is really just to kill packets if they get stuck in loops in badly configured networks. But most applications that send multicast set the TTL to a low number, often zero (where the message doesn’t even leave the originating device),
- one (so it will go only to computers on the local net), or two (where it will cross a single router). It’s quite rare to have an application that is intended to multicast to unknown machines over an entire campus network, much less the entire Internet.
- High TTL thresholds set on most routers: Many network routers, particularly WAN routers and internet gateway routers, have a higher TTL threshold set, such that they won’t send out multicast packets whose TTL is below (say) 15. This is intended to prevent accidental leakage of multicast off a local network.
- Routers are simply not configured to route multicast at all, or only configured for specific addresses, or otherwise blocking multicast packets.
UDP multicast might seem a bit exotic, but it’s actually more common that you think. It’s not used for web video sites like YouTube, since those need to send a video at a time each user demands, rather than at the same time for all users, and it’s not used for VoIP traffic. However, it is used for a lot for discovery and automatic confguration in apps like Skype, iTunes, and uPnP. It’s also used in a few places in the WCI portal.