From: Toki Toki Date: 2008-07-26T05:48:10+09:00 Subject: Re: Simultaneously URL call, is it possible? matu wrote: > Toki Toki wrote: > >> I've tested the code above, but it seems that it doesn't work like I >> thought because on the web server and application server logs I saw only >> one request when I run the code (of course with the correct address), >> maybe my statement isn't clear: I need to call a URL multiple time, like >> if I press F5 on the browser...I've found a way using Watir example, but >> without it would be better so I can use the script on any platform. >> > > It works if you run it from irb. If you call it from a script just call > Thread.join like Bret sad, or insert a sleep(10000) at the en of the > script. Ok, this would work well? require 'net/http' require 'uri' threads = [] 10.times do threads << Thread.new {Net::HTTP.get_response(URI.parse('http://www.google.com/'))} end threads.each {|x| x.join} Or your original script with the sleep: require 'net/http' require 'uri' 10.times do Thread.new {Net::HTTP.get_response(URI.parse('http://www.google.com/'))} end sleep(10000) -- Posted via http://www.ruby-forum.com/.