2 ms·
There are a few problems. First, common C standard library implementations also include POSIX implementations, unnecessarily conflating the two. POSIX does not
by SAI_Peregrinus 4y ago
There are a few problems.
First, common C standard library implementations also include POSIX implementations, unnecessarily conflating the two. POSIX does not require `getaddrinfo` to implement DNS over TCP, indeed it doesn't even have to use DNS at all.
Second, many programs rely on the OS-provided DNS when using a more capable library would be a better choice. Then they don't read the documentation for `getaddrinfo`, fail to check the `hints` field returned to see that it's UDP only, and still try to fall back to TCP and return an inevitably confusing error.
POSIX `getaddrinfo` is usually not what you want, but unfortunately it often works well enough that you don't notice until someone tries to run your program on a different OS.