From: mike@... (Mike Stok) Date: 2003-09-29T07:13:08+09:00 Subject: Re: TCPSocket.gethostbyname difficulties In article <1064759167.506592.9057.nullmailer@picachu.netlab.jp>, Yukihiro Matsumoto wrote: >Hi, > >In message "TCPSocket.gethostbyname difficulties" > on 03/09/26, "Nathaniel Talbott" writes: > >|I'm trying to use TCPSocket.gethostbyname to verify that a given domain >|actually exists in DNS. For some reason, though, some domains fail to >|resolve that resolve fine using other applications. For instance: >| >| irb(main):001:0> require 'socket' >| => true >| irb(main):002:0> TCPSocket.gethostbyname('noblepack.com') >| SocketError: host not found >| from (irb):2:in `gethostbyname' >| from (irb):2 > >This works for me: > > ruby -r socket -e 'p TCPSocket.gethostbyname("noblepack.com")' > ruby 1.8.0 (2003-09-27) [i686-linux] > ["noblepack.com", [], 2, "205.178.141.161"] > >Could you tell us more info? Although not addressed to me, on Mandrake Linux 9.1 I see [mike@ratdog mike]$ ruby -v -r socket -e 'p TCPSocket.gethostbyname("noblepack.com")' ruby 1.8.0 (2003-09-27) [i686-linux] -e:1:in `gethostbyname': host not found (SocketError) from -e:1 [mike@ratdog mike]$ ping -c 1 noblepack.com PING noblepack.com (205.178.141.161) 56(84) bytes of data. 64 bytes from 205.178.141.161: icmp_seq=1 ttl=119 time=52.9 ms --- noblepack.com ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 52.996/52.996/52.996/0.000 ms [mike@ratdog mike]$ ruby -v -r socket -e 'p TCPSocket.gethostbyname("stok.co.uk")' ruby 1.8.0 (2003-09-27) [i686-linux] ["berke-breathed.deathtongue.org", [], 2, "209.251.75.53"] Hope this helps, Mike -- mike@stok.co.uk | The "`Stok' disclaimers" apply. http://www.stok.co.uk/~mike/ | GPG PGP Key 1024D/059913DA mike@exegenix.com | Fingerprint 0570 71CD 6790 7C28 3D60 http://www.exegenix.com/ | 75D2 9EC4 C1C0 0599 13DA