HP Rp7410 BSD Sockets Interface Programmer's Guide - Page 117
Specifying the Outbound Interface, IP_MULTICAST_IF, Specifying the Scope of a Multicast,
View all HP Rp7410 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 117 highlights
Advanced Topics for Internet Datagram Sockets Sending and Receiving IP Multicast Datagrams Normally, multicast datagrams are sent only to systems directly connected to the same network that the sending interface is on. If multicast datagrams are intended for distant networks, a special multicast router must be present on the local and intermediate networks. A socket option IP_MULTICAST_TTL controls the number of intermediate systems through which a multicast datagram can be forwarded. If a multicast datagram is sent to a port from which an application on the local system is reading, normally a copy of the datagram is looped back and delivered to the application. A socket option IP_MULTICAST_LOOP allows the sending application to disable loopback for datagrams sent through that socket. Specifying the Outbound Interface IP_MULTICAST_IF Normally, multicast datagrams are sent through the interface that is associated with the default route, if one is configured. Alternatively, the system administrator can configure other interfaces as the default multicast route and as the route for specific multicast groups. The configured multicast routes should suffice for most applications. However, an application can override the default multicast route by setting the IP_MULTICAST_IF socket option. For example: #include struct in_addr addr; addr.s_addr = inet_addr("192.1.2.3"); setsockopt(s, IPPROTO_IP, IP_MULTICAST_IF, &addr, sizeof(addr)); If addr.s_addr is INADDR_ANY, subsequent outbound multicasts from the application are sent from the default interface. Otherwise, addr.s_addr must specify the IP address of a local network interface that supports multicasting. Specifying the Scope of a Multicast IP_MULTICAST_TTL By default, multicast datagrams are sent only to systems on a local network. If the multicast datagram is intended to be sent to distant networks, and if there is a special multicast router on the local network, the application can increase the scope of the multicast by using the IP_MULTICAST_TTL socket option. For example: Chapter 5 117