From: Paul Brannan Date: 2002-08-30T01:18:49+09:00 Subject: gethostbyname() requires reverse lookup to work? We ran into a problem last night where we could ping a host, telnet to it, ssh to it, look it up with dig, and traceroute to it, but the following ruby code failed: ruby -rsocket -e 'p Socket.gethostbyname("host")' The problem turned out to be that Ruby was looking up the host, and then doing a reverse lookup (and it also turned out that reverse lookup for this host was broken). We fixed the name server, and all was well. But I'm curious: what is the reason for writing socket.c this way? It seems almost silly to me to use getaddrinfo() to look up a host and then to use gethostbyaddr() to get the corresponding hostent structure (which to the best that I can tell, is what Ruby is doing; please correct me if I am mistaken). Why doesn't Ruby call gethostbyname() or getipnodebyname() directly? Paul