ECONNRESET (Whois :: ConnectionError) - error while trying to query Whois in Ruby

I am writing a simple program in Ruby to check if a domain list is accepted. It basically cycles through the list and uses the following function to check.

require 'rubygems'
require 'whois'

def check_domain(domain)
  c = Whois::Client.new
  c.query("google.com").available?
end

The program continues to log out (even when I'm on the google.com hard drive) and prints the message below. Given how simple the program is, I have run out of ideas - any suggestions?

/Library/Ruby/Gems/1.8/gems/whois-2.0.2/lib/whois/server/adapters/base.rb:165:in `query_the_socket': Errno::ECONNRESET: Connection reset by peer (Whois::ConnectionError)
from /Library/Ruby/Gems/1.8/gems/whois-2.0.2/lib/whois/server/adapters/verisign.rb:41:in `request'
from /Library/Ruby/Gems/1.8/gems/whois-2.0.2/lib/whois/server/adapters/base.rb:113:in `query'
from /Library/Ruby/Gems/1.8/gems/whois-2.0.2/lib/whois/server/adapters/base.rb:150:in `buffer_start'
from /Library/Ruby/Gems/1.8/gems/whois-2.0.2/lib/whois/server/adapters/base.rb:112:in `query'
from /Library/Ruby/Gems/1.8/gems/whois-2.0.2/lib/whois/client.rb:90:in `query'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/timeout.rb:62:in `timeout'
from /Library/Ruby/Gems/1.8/gems/whois-2.0.2/lib/whois/client.rb:87:in `query'
from checker.rb:7:in `check_domain'
from checker.rb:14
from checker.rb:11:in `each'
from checker.rb:11
+5
source share
3 answers

These are two possible explanations for this problem:

  • You are behind a firewall / proxy and the client cannot contact the server.
  • ( ) . .COM-, GoDaddy, reset . . . , .
+4

timeout:

irb(main):002:0> c = Whois::Client.new(:timeout => 100) # 100 seconds
irb(main):003:0> c.query("google.com").available?
=> true
+2

Did it work before? You are making too many requests to the whois server. Slowdown.

Didn't work before? You cannot contact whois server

0
source

All Articles