Lloyd; > > > > Net:http connections seem to hang sometimes too; can you > > > > fix that too? [...] > Please post the program in which it happens frequently, if > you want anyone here to help you. > > Or better yet, why not try to diagnose and fix the problem > yourself and then post the solution, instead of asking others > to do this for you? okok. I seem to have solved it: since I check that domain and path are not nil and match doamin and path regexes, it works fine. I'm extracting URLs, then ectract URLs to files from there, then download the files. So while sacnning the HTMLs, and matching the strings, things must have gone wrong frequently. In short: Net::http connections to nil hang.: this works: --------------------- require 'net/http' h = Net::HTTP.new('www.pragmaticprogrammer.com', 80) resp, data = h.get('/', nil) print data.length --------------------- this hangs forever: (which is obviously no bug; I just think there should be some nice error message or something) --------------------- require 'net/http' h = Net::HTTP.new(nil, 80) resp, data = h.get('/', nil) print data.length --------------------- Nobody would try to connect to nil, but when generating long arrays of URLs, some nonsense ones can slip in; those have to be catched ;) ruby 1.6.3 (2001-03-19) [i386-cygwin] The solution: try this (with ARGV: an integer as timeout seconds; something like 1, or 2, or 5) (probably one linebreak too many; because of email readers) --------------------- require 'net/http' require 'timeout' OUT_TIME = ARGV[0].to_i def get_data begin if @status = timeout(OUT_TIME) {h = Net::HTTP.new('www.pragmaticprogrammer.com', 80); resp, @data = h.get('/', nil)} print @data.length end rescue print $! end end get_data --------------------- the above times out nicely even with nil as domain. Tobi -- Tobias Reif http://www.pinkjuice.com/myDigitalProfile.xhtml go_to('www.ruby-lang.org').get(ruby).play.create.have_fun