In C programming, the functions getaddrinfo()
and getnameinfo()
convert domain names, hostnames, and IP addresses between human-readable text representations and structured binary formats for the operating system's networking API. Both functions are contained in the POSIX standard application programming interface (API).[1]
getaddrinfo and getnameinfo are inverse functions of each other. They are network protocol agnostic, and support both IPv4 and IPv6. It is the recommended interface for name resolution in building protocol independent applications and for transitioning legacy IPv4 code to the IPv6 Internet.
Internally, the functions may use a variety of resolution methods not limited to the Domain Name System (DNS). The Name Service Switch is commonly used on Unix-like systems and affects most implementation of this pair as it did with their BSD-socket era predecessors.[2]
© MMXXIII Rich X Search. We shall prevail. All rights reserved. Rich X Search