Created
January 16, 2012 07:08
-
-
Save kubo39/1619511 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'eventmachine' | |
EM.run do | |
resolver = proc do | |
['210.251.121.21', "8.8.8.8"].map do |addr| | |
begin | |
Resolv.getname addr | |
rescue | |
addr | |
end | |
end | |
end | |
handle_result = proc do |results| | |
results.each {|result| p result } | |
EM.stop | |
end | |
EM.defer(resolver, handle_result) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment