TCP/IP Programming Manual
Using Functions That Return IP Addresses
If your application uses functions that return IP addresses as int data types, the in6_addr structure
changes you made in Making Structure Changes (page 54) changes the destination of the return
value from an int to an array of char. This modification breaks the code and causes compiler
errors.
Make the following changes to your application, as needed:
AF_INET6 CodeAF_INET Code
struct in6_addr *addr;struct in_addr *addr;
foo(xxx, addr);addr->s_addr = foo(xxx);
Restructure the function to enable you to pass the address of the structure in the call. In addition,
modify the function to write the return value into the structure pointed to by addr.
Changing Socket Options
If your application uses IPv4 IP-level socket options, change them to the corresponding IPv6 options.
See setsockopt, setsockopt_nw (page 184) for more information.
Multicast Changes for IPv6
This subsection describes changes you need to make to perform multicast communications in IPv6.
This subsection describe IPv6 sending and receiving only. For information about multicast for IPv4
as well as overview information about IPv6 multicast communications, see Multicasting Operations
(page 44).
Sending IPv6 Multicast Datagrams
To send IPv6 multicast datagrams, an application indicates the multicast group to send to by
specifying an IPv6 multicast address in a sendto library call. (See sendto (page 177).) The system
maps the specified IPv6 destination address to the appropriate Ethernet or FDDI multicast address
prior to transmitting the datagram.
An application can explicitly control multicast options by using arguments to set the following
options in the setsockopt and setsockopt_nw library calls:
• Hop limit (IPV6_MULTICAST_HOPS)
• Multicast interface (IPV6_MULTICAST_IF)
• Disabling loopback of local delivery (IPV6_MULTICAST_LOOP)
NOTE: The syntax for and arguments to the setsockopt library call are described in
setsockopt, setsockopt_nw (page 184). The examples here and in Chapter 4 illustrate how to
use the setsockopt options that apply to IPv6 multicast datagrams only.
The IPV6_MULTICAST_HOPS option to the setsockopt library call allows an application to specify
a value between 0 and 255 for the hop limit field.
• Multicast datagrams that have a hop limit value of 0 restrict distribution of the multicast
datagram to applications running on the local host.
• Multicast datagrams that have a hop limit value of 1 are forwarded only to hosts on the local
link.
If a multicast datagram has a hop limit value greater than 1 and a multicast router is attached to
the sending host's network, multicast datagrams can be forwarded beyond the local link. Multicast
routers forward the datagram to known networks that have hosts belonging to the specified multicast
group.
Multicast Changes for IPv6 59