On Sep 12, 2009, at 9:15 PM, Clifford Heath wrote: > Ivan Shevanski wrote: >> I couldn't seem to get this running with threads, so I'm trying >> eventmachine. > > I think EM is overkill here. I disagree that EM is overkill here. EM is not a heavyweight library and does a *much* better job of this type of http async stuff then threads and net/http does that EM really should be the preferred way of doing something like this. require 'eventmachine' def make_request(site='http://www.website.com/', body={}) http = EventMachine::HttpRequest.new(site).post :body => body http.errback { p 'request failed' } http.callback { p http.response_header.status p http.response_header p http.response } end EM.run do # make a request every 1 second EM.add_periodic_timer(1) do make_request "http://foo.com/", :param => 'hi', :param2 => 'there' end end # look ma, no threads but I still get full async network concurrent IO. Cheers- Ezra Zygmuntowicz ez / engineyard.com