Internet Direct (Indy)
Home
PreviousUpNext
TIdStack.SetMulticastTTL Method

Specifies the mechanism used to change the "time to live" value for multicast packets using the specified socket.

Pascal
procedure SetMulticastTTL(
    AHandle: TIdStackSocketHandle; 
    const AValue: Byte; 
    const AIPVersion: TIdIPVersion = ID_DEFAULT_IP_VERSION
); virtual; abstract;
Parameters 
Description 
AHandle 
Handle for the socket.
 
AValue 
Time-to-live value to set in the socket options.
 
AIPVersion 
Scope is const. Type is TIdIPVersion. Default value is ID_DEFAULT_IP_VERSION

SetMulticastTTL is an abstract virtual method that specifies the mechanism used to change the "time to live" value in the multicast packets using the specified socket. 

SetMulticastTTL is used when sending multicast packets beyond the local network, since the default TTL for multicast packets is one. Multicast datagrams with a TTL of 0 are not transmitted on any subnetwork. Multicast datagrams with a TTL of greater than one may be delivered to more than one subnetwork if there are one or more multicast routers attached to the first-hop subnetwork. To send multicast packets beyond the local network, your local router and any other routers between you and the hosts you want to send to must be multicast capable (i.e. they must be "multicast routers," with support for IGMP). 

A multicast router does not forward multicast datagrams with destination addresses between 224.0.0.0 and 224.0.0.255, inclusive, regardless of their TTLs. This particular range of addresses is reserved for the use of routing protocols and other low-level topology discovery or maintenance protocols, such as gateway discovery and group membership reporting. Each multicast transmission is sent from a single network interface, even if the host has more than one multicast-capable interface. A socket option is available to override the default for subsequent transmissions from a given socket. For example 

If a multicast datagram is sent to a group to which the sending host itself belongs (on the outgoing interface), by default, a copy of the datagram is looped back by the IP layer for local delivery. Under some versions of UNIX, there is an option available to disable this behavior (IP_MULTICAST_LOOP). This option is not supported in Windows NT. If you try to disable this behavior, the call fails with the error WSAENOPROTOOPT (Bad protocol option). 

A multicast datagram sent with an initial TTL greater than 1 may be delivered to the sending host on a different interface from that on which it was sent, if the host belongs to the destination group on that other interface. The loopback control option has no effect on such delivery. 

SetMulticastTTL can also be used locate available multicast group members using a technique called the "expanding ring search"; this technique involves using a TTL value that increments from 0 until a response is received on from a multicast group address. The suggested TTL value sequence is 0, 1, 2, 4, 8, 16, 32, etc. Eventually, a response will be received from one or more group members "listening" on the same port number for the transmission. 

You can use any valid host group address as a destination address in an expanding ring search. You cannot use the "all-hosts" group (224.0.0.1) however, since multicast routers never forward packets destined for the all-hosts group beyond the local network (this limitation is similar to the limitation on packets sent to the IP broadcast address). 

SetMulticastTTL must be overridden and implemented in a descendant class that provides access to the specific capablities of the protocol stack for the operating system or platform hosting the Indy library.

Internet Direct (Indy) version 10.1.5
Copyright © 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Website http://www.indyproject.org.
Post feedback to the Indy Documentation newsgroup.