Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolv.getaddress fails w/ 'connect: name or service not known' on Windows #773

Closed
perlun opened this Issue May 28, 2013 · 3 comments

Comments

Projects
None yet
3 participants
@perlun
Copy link
Contributor

perlun commented May 28, 2013

Don't know if this related to #580, but it's the same method that fails... Running this:

> jruby -e "require 'resolv'; puts Resolv.getaddress 'www.jruby.org';"

...gives me the following output on Windows 8, x64:

SocketError: connect: name or service not known
             connect at org/jruby/ext/socket/RubyUDPSocket.java:193
          initialize at c:/jruby-1.7.4/lib/ruby/1.9/resolv.rb:766
  make_udp_requester at c:/jruby-1.7.4/lib/ruby/1.9/resolv.rb:537
       each_resource at c:/jruby-1.7.4/lib/ruby/1.9/resolv.rb:495
        each_address at c:/jruby-1.7.4/lib/ruby/1.9/resolv.rb:391
        each_address at c:/jruby-1.7.4/lib/ruby/1.9/resolv.rb:115
                each at org/jruby/RubyArray.java:1617
        each_address at c:/jruby-1.7.4/lib/ruby/1.9/resolv.rb:114
          getaddress at c:/jruby-1.7.4/lib/ruby/1.9/resolv.rb:92
          getaddress at c:/jruby-1.7.4/lib/ruby/1.9/resolv.rb:43
              (root) at -e:1

On OSX, this works and gives me 174.129.31.214.

(Using ping or nslookup on command line in Windows works and gives me that same IP address.)

@kimptoc

This comment has been minimized.

Copy link

kimptoc commented Aug 30, 2013

Also getting this problem - any thoughts on what the problem?

@headius

This comment has been minimized.

Copy link
Member

headius commented Aug 31, 2013

It looks like the resolv.rb library does have logic to use some Windows-specific logic, but only for finding the hosts file:

  class Hosts
    if /mswin|mingw|bccwin/ =~ RUBY_PLATFORM || ::RbConfig::CONFIG['host_os'] =~ /mswin/
      require 'win32/resolv'
      DefaultFileName = Win32::Resolv.get_hosts_path
    else
      DefaultFileName = '/etc/hosts'
    end
...

The logic for resolv.conf does not use 'host_os' to determine Windows. I will have a fix shortly.

@headius headius closed this in 0b7cf49 Aug 31, 2013

@kimptoc

This comment has been minimized.

Copy link

kimptoc commented Sep 2, 2013

Just grabbed 1.7.5-dev/HEAD and it works for me :) Many thanks for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.