In Files

  • resolv.rb

Resolv::DNS::Requester

Public Class Methods

new() click to toggle source
 
               # File resolv.rb, line 589
def initialize
  @senders = {}
  @sock = nil
end
            

Public Instance Methods

close() click to toggle source
 
               # File resolv.rb, line 617
def close
  sock = @sock
  @sock = nil
  sock.close if sock
end
            
request(sender, tout) click to toggle source
 
               # File resolv.rb, line 594
def request(sender, tout)
  timelimit = Time.now + tout
  sender.send
  while (now = Time.now) < timelimit
    timeout = timelimit - now
    if !IO.select([@sock], nil, nil, timeout)
      raise ResolvTimeout
    end
    reply, from = recv_reply
    begin
      msg = Message.decode(reply)
    rescue DecodeError
      next # broken DNS message ignored
    end
    if s = @senders[[from,msg.id]]
      break
    else
      # unexpected DNS message ignored
    end
  end
  return msg, s.data
end
            

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