1
0
mirror of https://github.com/becarpenter/book6.git synced 2024-05-07 02:54:53 +00:00
becarpenter-book6/1. Introduction and Foreword/How an application programmer sees IPv6.md

30 lines
1.9 KiB
Markdown
Raw Normal View History

2022-09-04 13:42:20 +12:00
## How an application programmer sees IPv6
2022-09-03 14:56:29 +12:00
In a very theoretical world, an application programmer could rely on
a DNS lookup to return the best (and only) address of a remote host,
and could then pass that address directly to the network socket
interface without further ado. Unfortunately the real world is not
that simple. Even without considering the version number, there are
several types of IP address, and a DNS lookup may return a variety
of addresses. In most cases, applications will use the function
2022-10-08 15:24:18 +13:00
```getaddrinfo()``` ("get address information") to obtain
2022-12-28 11:42:51 +13:00
a list of valid addresses, typically containing both IPv6 and IPv4
addresses. Which is the best one to use, and should the program try more than one?
2022-09-03 14:56:29 +12:00
We do not go into this subject in detail, because this book is
not aimed primarily at application programmers. However, operators
need to be aware that the default behavior of most applications
2022-10-08 15:24:18 +13:00
is simply to use the *first* address returned by ```getaddrinfo()```.
2022-09-03 14:56:29 +12:00
Some applications (such as web browsers) may use a smarter approach
2022-10-08 15:25:37 +13:00
known as "happy eyeballs" ([RFC8305](https://www.rfc-editor.org/info/rfc8305)) by means of a heuristic to detect which
2022-09-03 14:56:29 +12:00
address gives the fastest response. However, operators need to
understand the various address types in order to configure
2022-10-08 15:24:18 +13:00
systems optimally, including the ```getaddrinfo()``` precedence
2022-10-08 15:25:37 +13:00
table ([RFC6724](https://www.rfc-editor.org/info/rfc6724)) in every host.
2022-09-03 14:56:29 +12:00
2022-10-06 09:09:55 +13:00
Address types are discussed further in [2. Addresses](../2.%20IPv6%20Basic%20Technology/Addresses.md).
2022-12-28 11:42:51 +13:00
How applications relate to a mixture of IPv4 and IPv6 addresses is also discussed in [3. Dual stack scenarios](../3.%20Coexistence%20with%20Legacy%20IPv4/Dual%20stack%20scenarios.md).
<!-- Link lines generated automatically; do not delete -->
2022-10-06 09:09:55 +13:00
### [<ins>Previous</ins>](How%20a%20user%20sees%20IPv6.md) [<ins>Next</ins>](How%20a%20network%20operations%20center%20sees%20IPv6.md) [<ins>Chapter Contents</ins>](1.%20Introduction%20and%20Foreword.md)