On Thu, 15 Nov 2012 20:07:38 -0500, Roy Smith wrote: >>> gethostbyname() and getaddrinfo() use the NSS (name-service switch) >> mechanism, which is configured via /etc/nsswitch.conf. Depending upon >> configuration, hostnames can be looked up via a plain text file >> (/etc/hosts), Berkeley DB files, DNS, NIS, NIS+, LDAP, WINS, etc. > > Gethostbyname() long predates NSS.
Before NSS there was host.conf, which provided similar functionality except that the set of mechanisms was fixed (they were built into libc rather than being dynamically-loaded libraries) and it only applied to hostnames (NSS is also used for getpwent(), getprotoent(), etc). > For that matter, I think it even predates DNS (i.e. back to the days > when /etc/hosts was the *only* way to look up a hostname). > > But, that's a nit. Indeed; the main point is that gethostbyname() has never been specific to DNS. -- http://mail.python.org/mailman/listinfo/python-list