From: Bret Pettichord Date: 2008-07-26T04:02:18+09:00 Subject: Re: Simultaneously URL call, is it possible? ------=_Part_15317_2924013.1217012893874 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline On Fri, Jul 25, 2008 at 1:25 PM, Toki Toki wrote: > > require 'net/http' > > require 'uri' > > 10.times do > > Thread.new do > > Net::HTTP.get_response(URI.parse('http://www.google.com/' > )) > > end > > end > > > > maybe this is a bit more clear to you? > > Thanks, I saw that the first curly brace need to be on the same line of > Thread.new. > > 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. > > I think this needs a call to Thread#join after all the the threads have been created. Otherwise the script will exit before the threads have executed. Bret -- Bret Pettichord CTO, WatirCraft LLC, http://www.watircraft.com Lead Developer, Watir, http://wtr.rubyforge.org Blog (Essays), http://www.io.com/~wazmo/blog MiniBlog (Links), http://feeds.feedburner.com/bretshotlist ------=_Part_15317_2924013.1217012893874--