From: Hassan Schroeder Date: 2011-07-23T06:46:36+09:00 Subject: Re: open localhost url On Fri, Jul 22, 2011 at 11:59 AM, Smp Mp wrote: > When I call call the below code I get a timeout. > http_object = Net::HTTP.new("localhost", "3000") > hresp, data = > http_object.get("/documents/wdocs/generatedata?"+query_string ,"", nil) > > But when application is running on port 3000 and a copy of the same > application is running on a different port(3001) , then it works fine. > > http_object = Net::HTTP.new("localhost", "3001") > hresp, data = > http_object.get("/documents/wdocs/generatedata?"+query_string ,"", nil) > > the code is called from test_controller. is there any way i could call > the url? Not using Webrick -- that's a single-threaded server, so it can't respond to your request until it finishes what it's doing -- sending your request. Which obviously doesn't work too well. :-) If you were running something multi-threaded, e.g. multiple unicorns, Passenger, etc. it would be fine, if architecturally sketchy (IMO). HTH, -- Hassan Schroeder ------------------------ hassan.schroeder@gmail.com http://about.me/hassanschroeder twitter: @hassan