> > * getfqdn(): The function seems to not always return the FQDN. For > >example, if I run the following code from 'mybox.mydomain.com', I get
> >strange output. Does getfqdn() remove the common domain between my > >hostname and the one that I'm looking up? > >>>> socket.getfqdn('otherbox') > >'OTHERBOX' > ># expected 'otherbox.mydomain.com' > > getfqdn() calls the system library gethostbyaddr(), and searches the > result for the first name that contains '.' or if no name contains dot, it > returns the canonical name (as defined by gethostbyaddr() and the system > host name resolver libraries (hosts file, DNS, NMB)). After a little more investigation here, it appears that getfqdn() returns the name unchanged (or perhaps run through the system's resolver libs) if there's no reverse DNS PTR entry. In the case given above, otherbox.mydomain.com didn't have a reverse DNS entry, so getfqdn() returned 'OTHERBOX'. However, when getfqdn() is called with a name whose IP *does* have a PTR record, it returns the correct FQDN. Thanks for the help. Now, couple more questions: getnameinfo() accepts the NI_NAMEREQD flag. It appears, though that a name lookup (and associated error if the lookup fails) occurs independent of whether the flag is specified. Does it actually do anything? Does getnameinfo() support IPv6? It appears to fail (with a socket.error that says "sockaddr resolved to multiple addresses") if both IPv4 and IPv6 are enabled. --Bruce _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com