https://github.com/astro/em-asyncns
Resolve domain names from EventMachine with libasyncns
https://github.com/astro/em-asyncns
Last synced: about 1 year ago
JSON representation
Resolve domain names from EventMachine with libasyncns
- Host: GitHub
- URL: https://github.com/astro/em-asyncns
- Owner: astro
- Created: 2009-05-10T18:11:40.000Z (about 17 years ago)
- Default Branch: master
- Last Pushed: 2009-05-11T21:22:07.000Z (about 17 years ago)
- Last Synced: 2025-03-24T05:12:54.258Z (about 1 year ago)
- Language: Ruby
- Homepage:
- Size: 89.8 KB
- Stars: 11
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Motivation
==========
Connecting to hostnames from EventMachine? Dissatisfied from the
Dnsruby experience? Disappointed by the lack of EventMachine support
in Dnsruby trunk? Then you want this.
Usage
=====
require 'em/resolver'
EM.run {
res = EventMachine::Resolver.new
q = res.getaddrinfo("localhost")
q.callback do |addresses|
addresses.each { |address|
spam! address
}
end
q.errback do |error|
puts "Oh noes: #{error}"
end
}
Dnsruby compatibility
=====================
A drop-in replacement for Dnsruby is provided given you use the
library exactly as stated in the [EventMachine FAQ](http://rubyeventmachine.com/wiki/FAQ#DoesEMblockonDNSresolutionsi.e.ifyoustartaconnectiontotakes_ages.comwillittemporarilyblocktheotherprocesseswhileitworks).
See spec/dnsruby_spec.rb for details.
ext/asyncns.h
=========
...is included in a slightly modified form because the original one
had parameter names like `class' which prevents compiling as C++.