On Tue, 17 Aug 2004, vaidya sn wrote:
I am using gethostname n gethostbyname in one of my application ... to get the fully qualified hostname.
What I have seen in portabe code is two paths:
1. Local IP known
gethostbyaddr(ip)
2. Local IP not known (or above failed)
hostname() to get the local hostname gethostbyname() to resolve it into a fqdn.
then verify that the result contains at least one dot.. (quite common misconfiguration errors may cause gethostbyX to return unqualified name).
i want to ensure that this will work in all distribution versions of linux ... be it redhat, mandrake , fedora etc etc ...
The above works in all OS:es I have heard of.
Regards Henrik - : send the line "unsubscribe linux-net" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html