From: matz@... (Yukihiro Matsumoto) Date: 2003-09-30T18:34:55+09:00 Subject: Re: TCPSocket.gethostbyname difficulties Hi, In message "Re: TCPSocket.gethostbyname difficulties" on 03/09/30, Reimer Behrends writes: |This surprises me, since there is no PTR record for 205.178.141.161, |and ruby (1.8.0 in my case) insists on doing a gethostbyaddr() on |that address (in sock_hostbyname()) and will raise a "host not |found" error if gethostbyaddr() fails (usually if there is no PTR |record). That lookup is performed regardless of the value of |Socket.do_not_reverse_lookup. | |Incidentally, what is the rationale behind requiring the presence of |a PTR record? There are many hosts that do not have one, especially |virtual web hosts, and I have found Socket/TCPSocket.gethostbyname to be |fairly useless as a result (and instead resorted to using |Resolv.getaddress[es]). Ah, thanks. Your message reminds me Ruby's gethostbyname method is implemented by the combination of getaddrinfo() and gethostbyaddr(). The reason behind this is plain gethostbyname() does not work well with IPv6 addresses (on some platforms). I want to fix this, but I don't know how (yet). matz.