Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > SocketError: getaddrinfo: nodename nor servname provided, or

Reply
Thread Tools

SocketError: getaddrinfo: nodename nor servname provided, or

 
 
Baq Haidri
Guest
Posts: n/a
 
      05-06-2008
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
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
 
Michael Boutros
Guest
Posts: n/a
 
      05-07-2008
Can we pleas see the code that is causing this error?
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
 
Baq Haidri
Guest
Posts: n/a
 
      05-07-2008
Here's the code:

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







--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
Michael Boutros
Guest
Posts: n/a
 
      05-07-2008
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.
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
Baq Haidri
Guest
Posts: n/a
 
      05-07-2008
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...)

Michael Boutros wrote:
> 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.


--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Net::HTTP error -- getaddrinfo: nodename nor servname provid Doug Livesey Ruby 0 04-07-2010 08:58 PM
"No address associated with nodename" Tim Hunter Ruby 3 10-08-2007 11:28 PM
DocumentBuilder object is not able to parse a XML String which has a nodename which contains forward slash! Ed Java 6 08-02-2007 03:29 PM
gaierror: (8, 'hostname nor servname provided, or not known') Laszlo Nagy Python 2 07-31-2006 06:56 PM
xmlrpc: hostname nor servname provided ? Laszlo Nagy Python 0 07-25-2006 08:48 PM



Advertisments