HPlogo HP-UX IPv6 Porting Guide: HP-UX 11i v2 September 2004 > Chapter 5 Overview of IPv4 and IPv6 Call Set-up

Using AF_INET6 Socket for IPv6 Communications

» 

Technical documentation

Complete book in PDF

 » Table of Contents

For IPv6 communications, create an AF_INET6 socket and pass it a sockaddr_in6 structure that contains an IPv6 address that is not an IPv4-mapped IPv6 address (for example, 2fee:1212::200:2bff:fe2d:0c2c). The diagram below shows the sequence of events for an application that uses an AF_INET6 socket to send IPv6 packets.

Figure 5-4 Title not available (Using AF_INET6 Socket for IPv6 Communications)

  1. Application calls getaddrinfo() and passes the host name (host6), the IPv6 AF_INET6 address family hint, and the AI_DEFAULT flag hint. The flag hint tells the function to find an IPv6 address for host6, then return it if found. See getaddrinfo(3) for a description of hints fields and values.

  2. The search finds an IPv6 address for host6 in the hosts database, then getaddrinfo returns the IPv6 address 2fee:1212::200:2bff:fe2d:0c2c.

  3. The application opens an AF_INET6 socket.

  4. The application sends information to the 2fee:1212::200:2bff:fe2d:0c2c address.

  5. The socket layer passes the information and address to the UDP module.

  6. The UDP module identifies the IPv6 address and puts the 2fee:1212::200:2bff:fe2d:0c2c address into the packet header and passes the information to the IPv6 module for transmission.

© 2004 Hewlett-Packard Development Company, L.P.