HP Rp3440-4 - 9000 - 0 MB RAM Programmer's Manual page 117

Bsd sockets interface programmer’s guide
Hide thumbs Also See for Rp3440-4 - 9000 - 0 MB RAM:
Table of Contents

Advertisement

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 <netinet/in.h>
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

Advertisement

Table of Contents
loading

Table of Contents