SocketError: getaddrinfo: nodename nor servname provided, or

B

Baq Haidri

I'm trying to use Net/Http and am getting the following error:

SocketError: getaddrinfo: nodename nor servname provided, or not known

I'm on Mac OS X, Leopard, check out my ruby version/gem env below.

Also, I double checked my etc/hosts and I do see an entry for
localhost/127.0.0.1 there. Seems like this is a Leopard issue?

[baq@baq:~]$ ruby -v
ruby 1.8.6 (2007-09-24 patchlevel 111) [universal-darwin9.0]

[baq@baq:~]$ gem environment
RubyGems Environment:
- RUBYGEMS VERSION: 1.0.1 (1.0.1)
- RUBY VERSION: 1.8.6 (2007-09-24 patchlevel 111)
[universal-darwin9.0]
- INSTALLATION DIRECTORY: /Library/Ruby/Gems/1.8
- RUBYGEMS PREFIX:
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby
- RUBY EXECUTABLE:
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
- RUBYGEMS PLATFORMS:
- ruby
- universal-darwin-9
- GEM PATHS:
-
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8
- /Library/Ruby/Gems/1.8
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://gems.rubyforge.org
 
M

Michael Boutros

Try this:

require 'net/http'
Net::HTTP.start('www.google.com') do |http|
response = http.get('/')
puts response
end


#start doesn't take the protocol.
 
B

Baq Haidri

Great, that did it!

Thanks Michael! (and I apologize to everyone who was spammed with this
message--I *did* do a google search & doc search but couldn't find a
solution...)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,573
Members
45,046
Latest member
Gavizuho

Latest Threads

Top