TCP/IP Programming Manual

3. The application calls socket to create an AF_INET6 socket, using the address family and socket
type contained in the addrinfo structure.
4. If the socket call is successful, the application calls connect to establish a connection with
host1, using the host address and length in the addrinfo structure. If the connect call is
successful, the application sends information to the 3ffe:1200::a00:2bff:fe2d:02b2 address.
NOTE: After using the information in the addrinfo structures, the application calls freeaddrinfo
to free system resources used by the structures.
5. The socket layer passes the information and address to the UDP module.
6. The UDP module identifies the IPv6 address, puts the 3ffe:1200::a00:2bff:fe2d:02b2 address
into the packet header, and passes the information to the IPv6 module for transmission.
From this point, the application can do the following:
Call recv to wait for a response from the server system.
After the application receives a response, call getpeername, getpeername_nw to determine
the address of the connected socket. The address is returned in a structure of type sockaddr_in6.
Call getnameinfo using the NI_NAMEREQD flag to obtain the server name.
Call getnameinfo using the NI_NUMERICHOST flag to convert the server address to a text
string. Chapter 5 contains sample client program code that demonstrates these steps.
Using AF_INET6 Guardian Sockets for IPv4 Communications
You can also use an AF_INET6 socket for IPv4 communications. Figure 3 (page 50) shows the
sequence of events for a client application that uses an AF_INET6 socket to send IPv4 packets.
(For information about IPv4 mapped IPv6 addresses, see the TCP/IPv6 Configuration and
Management Manual.)
Figure 3 Using AF_INET6 Sockets for IPv4 Communications (Send)
50 Porting and Developing IPv6 Applications (NonStop TCP/IPv6 and CIP Only)