Is there any function(C or C++) which returns FQDN(Fully qualified domain name) in UNIX platforms?
相关问题
- Multiple sockets for clients to connect to
- What is the best way to do a search in a large fil
- glDrawElements only draws half a quad
- IPAddress.[Try]Parse parses 192.168 to 192.0.0.168
- Index of single bit in long integer (in C) [duplic
Use
getifaddrs()
to get the interfaces for the box in question, then use the "resolver interface" (man resolver
) to query the FQDNs for the ip-addresses return by the former call togetifaddrs()
.Do not use
gethostname()
or the command line toolhostname
in this context, as an IXish box's "hostname" does not necessarily correlate with the FQDN's returned by a query issued for the box's interface-addresses via the "resolver interface".