Resolv-replace issue

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

On May 2, 2006, at 2:20 PM, Curtis Spencer wrote:

[…]

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:

resolv-replace is working fine for me with your (snipped) code. Make
sure your resolv.conf and hosts file get picked up correctly by resolv.


Eric H. - [email protected] - http://blog.segment7.net
This implementation is HODEL-HASH-9600 compliant

http://trackmap.robotcoop.com