# File lib/rubydns/resolver.rb, line 199 def initialize(request, host, port) @request = request @host = host @port = port end
# File lib/rubydns/resolver.rb, line 194 def self.open(host, port, request) # Open a datagram socket... EventMachine doesn't support connected datagram sockets, so we have to cheat a bit: EventMachine::open_datagram_socket('', 0, self, request, host, port) end
# File lib/rubydns/resolver.rb, line 205 def post_init # Sending question to remote DNS server... send_datagram(@request.packet, @host, @port) end
# File lib/rubydns/resolver.rb, line 210 def receive_data(data) # Receiving response from remote DNS server... message = RubyDNS::decode_message(data) # The message id must match, and it can't be truncated: @request.process_response!(message) rescue Resolv::DNS::DecodeError => error @request.process_response!(error) end
Generated with the Darkfish Rdoc Generator 2.