Last Modified
2013-04-17 00:31:49 -0700
Requires
  • socket
  • fcntl
  • timeout
  • thread
  • securerandom
  • win32/resolv
  • win32/resolv

Description

resolv library

resolv.rb is a resolver library written in Ruby. Since it is written in Ruby, it is thread-aware. I.e. it can resolv many hostnames concurrently.

It is possible to lookup various resources of DNS using DNS module directly.

example

p Resolv.getaddress("www.ruby-lang.org")
p Resolv.getname("210.251.121.214")

Resolv::DNS.open {|dns|
  p dns.getresources("www.ruby-lang.org", Resolv::DNS::Resource::IN::A).collect {|r| r.address}
  p dns.getresources("ruby-lang.org", Resolv::DNS::Resource::IN::MX).collect {|r| [r.exchange.to_s, r.preference]}
}

Resolv class

class methods

Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.

If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.

If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.

If you want to help improve the Ruby documentation, please visit Documenting-ruby.org.

blog comments powered by Disqus