RubyDNS::Resolver::Request::UDPRequestHandler

Public Class Methods

new(request, host, port) click to toggle source
# File lib/rubydns/resolver.rb, line 199
def initialize(request, host, port)
        @request = request
        @host = host
        @port = port
end
open(host, port, request) click to toggle source
# 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

Public Instance Methods

post_init() click to toggle source
# File lib/rubydns/resolver.rb, line 205
def post_init
        # Sending question to remote DNS server...
        send_datagram(@request.packet, @host, @port)
end
receive_data(data) click to toggle source
# 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

[Validate]

Generated with the Darkfish Rdoc Generator 2.