Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to do a DNS lookup

28 views
Skip to first unread message

Nigel Gilbert

unread,
Dec 25, 2001, 7:19:36 PM12/25/01
to
I have an IP address such as '111.222.111.222' and want to resolve this to a
domain name. What's the simplest Ruby code that will return the name?
There doesn't seem to be anything expressly designed to do this that I can
see in the net libraries, or am I missing something?

Thanx

Nigel

ts

unread,
Dec 26, 2001, 9:16:54 AM12/26/01
to
>>>>> "N" == Nigel Gilbert <scs...@pop.ntlworld.com> writes:

N> I have an IP address such as '111.222.111.222' and want to resolve this to a
N> domain name. What's the simplest Ruby code that will return the name?
N> There doesn't seem to be anything expressly designed to do this that I can
N> see in the net libraries, or am I missing something?

You have resolv.rb in the distribution

pigeon% ruby -rresolv -e 'p Resolv.getname("138.102.114.1").to_s'
"moulon.moulon.inra.fr"
pigeon%

probably you need ruby >= 1.6.5

--

Guy Decoux

0 new messages