This article examines the historical and technical issues with the gethostbyname and getaddrinfo DNS resolution APIs, explaining why they're fundamentally flawed for reliable DNS lookups. It traces the evolution of these functions from their origins in 1980s BSD systems to modern implementations, highlighting their blocking nature and lack of portability. The author strongly recommends using dedicated DNS resolver libraries like c-ares or OpenBSD's libasr for applications requiring robust DNS functionality.
Background
The gethostbyname function is a legacy DNS resolution API that has been part of Unix-like systems since the 1980s, but its design limitations make it problematic for modern applications that require reliable and efficient DNS lookups.
- Source
- Lobsters
- Published
- May 4, 2026 at 07:50 PM
- Score
- 7.0 / 10