What does time-to-live (TTL) mean?
Time-to-live, or TTL, is an 8-bit unsigned byte that is assigned to each multicast packet. For each route, the TTL value stored in the packet is decremented. When it reaches zero, the packet is discarded. So setting the TTL value of a packet (via setTTL()) controls how many hops it can travel. This is especially important when programming multicast applications, because you don't want to send your packets to every host in the world--you want to restrict your packets to certain places. For example, you might want to make sure that the packets are restricted to you local LAN, so you set TTL to be one or two. Or, if you are writing a multicast application for a WAN, you might need to set TTL to be 10 or more.