Forum: Ruby Can you give me an example?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Xan (Guest)
on 2006-06-12 18:03
(Received via mailing list)
Hello,

I'm trying to write some code with Ruby. I need to write a DNS resolver.
I saw a resolv.rb but there is simple example that I can take.
Specifically, I need:

- Create object r (that resolvs my dns): something like r =
Resolver.new()
- Put hostname and ip in this object: something like r.add(hostname, ip)
- Consult if this object knows anything about a specific hostname:
something like r.query(hostname) --> ip
  and consult if this object knows anything about a specific ip:
something like r.query(ip) --> hostname
- Specify what it has to do if it does not know nothing about a concrete
hostname or ip:
  something like
      r.parentresolver(none) --> if r does not know ip of one hostname,
then there is no procedure for determining it
      r.parentresolver(ip) --> the parent DNS for resolv unknown
hostnames

I know that all of that can do with resolv.rb but I don't know how.
Can you put me an example of how do it?


Thank you very much,
Xan.
This topic is locked and can not be replied to.