HP-UX IPv6 Porting Guide (September 2004)
Table Of Contents
- About This Document
- 1 Introduction
- 2 IPv6 Addressing
- 3 Data Structure Changes
- 4 Migrating Applications from IPv4 to IPv6
- 5 Overview of IPv4 and IPv6 Call Set-up
- 6 Function Calls Converting Names to Addresses
- 7 Function Calls Converting IP addresses to Names
- 8 Reading Error Messages
- 9 Freeing Memory
- 10 Converting Binary and Text Addresses
- 11 Testing for Scope and Type of IPv6 addresses using Macros
- 12 Identifying Local Interface Names and Indexes
- 13 Configuring or Querying an Interface using IPv6 ioctl() Function Calls
- 14 Verifying IPv6 Installation
- 15 Sample Client/Server Programs
- A IPv4 to IPv6 Quick Reference Guide

Overview of IPv4 and IPv6 Call Set-up
Using AF_INET6 Socket for IPv6 Communications
Chapter 5 29
Using AF_INET6 Socket for IPv6 Communications
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
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.