IPv6 Multicasting (2) examples Sending multicast packets s = socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP); /* XXX use getaddrinfo instead */ /* specify the outgoing interface */ ifindex = if_nametoindex(outifname); /* e.g. outifname = "ne0" */ setsockopt(s, IPPROTO_IPV6, IPV6_MULTICAST_IF, &ifindex, sizeof(ifindex)); /* specify the hoplimit: note that the system default is 1 */ hlim = 64; setsockopt(s, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, &hlim, sizeof(hlim)); /* send a packet */ sendto(s, buf, buflen, 0, dst, dstlen);