From: Stefan Mahlitz Date: 2007-12-24T20:46:16+09:00 Subject: Re: Unable to run the code Pradeepta Swain wrote: > Hi > > I am trying to get a webpage using this code > > require 'net/http' > Net::HTTP.start('www.rubyinside.com') do |http| > req = Net::HTTP::Get.new('/test.txt') > puts http.request(req).body > end > > but it is giving error like > > c:/apps/ruby/lib/ruby/1.8/net/http.rb:560:in `initialize': Bad file > descriptor - connect(2) (Errno::EBADF) > from c:/apps/ruby/lib/ruby/1.8/net/http.rb:560:in `connect' > from c:/apps/ruby/lib/ruby/1.8/timeout.rb:48:in `timeout' > from c:/apps/ruby/lib/ruby/1.8/timeout.rb:76:in `timeout' > from c:/apps/ruby/lib/ruby/1.8/net/http.rb:560:in `connect' > from c:/apps/ruby/lib/ruby/1.8/net/http.rb:553:in `do_start' > from c:/apps/ruby/lib/ruby/1.8/net/http.rb:542:in `start' > from c:/apps/ruby/lib/ruby/1.8/net/http.rb:440:in `start' > from ft.rb:15 > > what should I do to run the program . please help me out ! Do you have a firewall or proxy between your PC and the internet? I remember that I had a problem like this (years ago). Just a wild guess. Stefan