Sending And Receiving Ip Multicast Datagrams; Sending Ip Multicast Datagrams - HP Rp3440-4 - 9000 - 0 MB RAM Programmer's Manual

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

Sending and Receiving IP Multicast
Datagrams
IP multicasting provides a mechanism for sending a single datagram to a
group of systems. Normally, only systems that have joined the multicast
group process the datagrams.
Multicast datagrams are transmitted and delivered with the same "best
effort" reliability as regular unicast IP datagrams. That is, the
datagrams are not guaranteed to arrive intact at all members of the
destination group or in the same order as the datagrams were sent.
Membership in a multicast group is dynamic. That is, systems can join
and leave groups at any time. A system remains a member of a multicast
group until the last socket that joined the group is closed or has dropped
membership in the group. A system can be a member of more than one
group at a time. A system that has multiple interfaces might be a
member of the same group on each interface.

Sending IP Multicast Datagrams

IP multicasting is supported only for AF_INET sockets of type
SOCK_DGRAM and only on networks for which the interface supports
multicasting.
To send a multicast datagram, the application specifies an IP multicast
address as the destination address in a sendto(2) call. For example:
#include <netinet/in.h>
struct sockaddr_in servaddr;
servaddr.sin_family = AF_INET;
servaddr.sin_port = 12345;
servaddr.sin_addr.s_addr = inet_addr("224.1.2.3");
sendto(s, buf, buflen, 0, &servaddr, sizeof(servaddr));
It is not necessary for the system to join a multicast group in order to
send multicast datagrams.
Each multicast datagram is sent from one network interface at a time,
even if the system has joined the destination multicast group on more
than one interface. The system administrator configures a default
interface from which to send multicast datagrams. An application can
override the default by setting a socket option IP_MULTICAST_IF to
specify the outbound interface for datagrams sent through that socket.
116
Chapter 5

Advertisement

Table of Contents
loading

Table of Contents