`sysread' end of file reached `rbuf_fill' problem

Discussion in 'Ruby' started by Mento Ruby, Dec 11, 2006.

  1. Mento Ruby

    Mento Ruby Guest

    when my problem is using multithreading to get some documents from www
    server through net::http library. The code is as follows


    Net::HTTP.start(url.host) do |http|
    req = Net::HTTP::Get.new(url.path, {"User-Agent" =>
    "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR
    1.1.4322; InfoPath.1)"})
    response = http.request(req)
    http.finish()
    case response
    when Net::HTTPSuccess
    then return response.body
    else
    puts "Response Not Success"
    return ""
    end
    end

    I always receive errors as follows:

    C:/ruby/lib/ruby/1.8/net/protocol.rb:133:in `sysread': end of file
    reached (EOFE
    rror)
    from C:/ruby/lib/ruby/1.8/net/protocol.rb:133:in `rbuf_fill'
    from C:/ruby/lib/ruby/1.8/timeout.rb:56:in `timeout'
    from C:/ruby/lib/ruby/1.8/timeout.rb:76:in `timeout'
    from C:/ruby/lib/ruby/1.8/net/protocol.rb:132:in `rbuf_fill'
    from C:/ruby/lib/ruby/1.8/net/protocol.rb:86:in `read'
    from C:/ruby/lib/ruby/1.8/net/http.rb:2229:in `read_chunked'
    from C:/ruby/lib/ruby/1.8/net/http.rb:2204:in `read_body_0'
    from C:/ruby/lib/ruby/1.8/net/http.rb:2170:in `read_body'

    And....

    c:/ruby/lib/ruby/1.8/net/http.rb:560:in `initialize': Bad file
    descriptor - connect(2) (Errno::EBADF)
    from c:/ruby/lib/ruby/1.8/net/http.rb:560:in `open'
    from c:/ruby/lib/ruby/1.8/net/http.rb:560:in `connect'
    from c:/ruby/lib/ruby/1.8/timeout.rb:48:in `timeout'
    from c:/ruby/lib/ruby/1.8/timeout.rb:76:in `timeout'
    from c:/ruby/lib/ruby/1.8/net/http.rb:560:in `connect'
    from c:/ruby/lib/ruby/1.8/net/http.rb:553:in `do_start'
    from c:/ruby/lib/ruby/1.8/net/http.rb:542:in `start'

    --
    Posted via http://www.ruby-forum.com/.
    Mento Ruby, Dec 11, 2006
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Muazzam Mushtaq
    Replies:
    0
    Views:
    354
    Muazzam Mushtaq
    Mar 28, 2006
  2. vishnu
    Replies:
    0
    Views:
    338
    vishnu
    May 31, 2006
  3. vishnu
    Replies:
    0
    Views:
    193
    vishnu
    May 31, 2006
  4. Mario Ruiz

    Net::Http, end of file reached

    Mario Ruiz, Sep 23, 2009, in forum: Ruby
    Replies:
    2
    Views:
    402
    Mario Ruiz
    Sep 23, 2009
  5. Yary H
    Replies:
    0
    Views:
    120
    Yary H
    Oct 3, 2004
Loading...

Share This Page