[Pythonmac-SIG] socket.gethostbyaddr(socket.gethostname())

Jack Jansen jack@oratrix.nl
Wed, 16 Aug 2000 12:38:27 +0200


> Yo,
> 
> I'm finding that the call socket.gethostbyaddr(socket.gethostname()) (called
> all over the place in smtplib for example) generates an error (host not
> found) when the machine it's executed on doesn't have a DNS IP address
> reverse mapping PTR record (this record allows fo the reverse mapping from
> an IP address to a host name).

Well, the relevant internet standards speficially say that you _must_ have a 
PTR record for all machines. But, the fact that I get 3 messages a week from 
people who can't access ftp.cwi.nl shows that a lot of ISPs indeed happily 
ignore this:-(

The solution is to add the PTR (and A, of course) record for your own machine 
to your hosts file.

And, on smtplib: again by the standard it should pass the official name (fqdn) 
in the HELO command. It might be allowable, though, to pass [xx.xx.xx.xx] or 
so (rfc821 is a long time ago, I don't remember).
--
Jack Jansen             | ++++ stop the execution of Mumia Abu-Jamal ++++
Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++
www.oratrix.nl/~jack    | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm