`sysread' end of file reached `rbuf_fill' problem

M

Mento Ruby

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'
 

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

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top