Hi,
I am trying to get some more parallelism out of a crawler I wrote by
using resolv-replace, but I can’t seem to get it to correctly resolve
addresses. I tryed the following code:
require ‘net/http’
require ‘open-uri’
require ‘resolv-replace’
Thread.abort_on_exception = true
thread = Thread.new do
begin
open(‘http://www.google.com’) do |file|
puts file.read
end
rescue
puts $!
end
end
thread = Thread.new do
begin
Net::HTTP.get(“www.google.com”, “/”)
rescue
puts $!
else
puts “success”
end
end
1.upto(50) do
puts “ping”
sleep 1
end
This doesn’t work unless I comment out the require ‘resolv-replace’
line. If I try it with the resolv-replace, then I get output like this:
ping
ping
ping
ping
Hostname not known: www.google.com
ping
Hostname not known: www.google.com
Any ideas why it can’t resolve, yet when I use the non ruby resolver it
works correctly. My ruby version is:
ruby 1.8.4 (2005-12-24) [i686-darwin8.6.1]
Thanks,
Curtis