From: rdlugosz.1044583@... Date: 2004-09-01T06:38:17+09:00 Subject: Re: Two issues with webrick - both threading & OS related --- ruby-talk@ruby-lang.org wrote: > So, how about it, list, which ruby build for win32 should he be using? > cygwin or mscv or something else? OK - now it gets interesting... on LINUX this time: ryan@deuce:~$ uname -a Linux deuce.dlugosz.net 2.4.20-20.7smp #1 SMP Mon Aug 18 14:46:14 EDT 2003 i686 unknown ruby info: URL: http://deuce.dlugosz.net:12306 [2004-08-31 17:23:09] INFO WEBrick 1.3.1 [2004-08-31 17:23:09] INFO ruby 1.8.1 (2003-12-25) [i686-linux] I get the *same* blocked request problem! And finally, on a second *completely separate* linux box (with the same ruby & webrick versoins): Linux vps.dlugosz.net 2.4.20-021stab022.3.777-enterprise #1 SMP Wed Aug 4 19:02:12 MSD 2004 i686 i686 i386 GNU/Linux I *still* get the blocking issue. At this point I'm either running into a webrick bug or I've got a fundamental flaw in the script. I'll post it at end againso that you can look at precisely what I'm doing... > Also his second problem is about select() on win32 does not operate on > the return of pipe(). That makes sense - I'm not using the cygwin version, but rather the one-click installer. The IO stuff claims that it's not supported on all platforms so perhaps this is the expected result? Thanks for your help! -Ryan THE CODE: require 'webrick' include WEBrick class SleepServer < HTTPServlet::AbstractServlet def do_GET(req,resp) resp.body="Start: #{Time.new}\n" sleep(10) resp.body << "End: #{Time.new}\n" resp['content-type'] = 'text/plain' end end class GreetServer < HTTPServlet::AbstractServlet def do_GET(req, resp) resp.body="Hi, now is: #{Time.new}\n" resp['content-type']='text/plain' end end default_port = (12301 + (Dir.pwd.hash % 1000)).to_s $port = (ARGV[0] || default_port).to_i puts "URL: http://#{Socket.gethostname}:#$port" $s = HTTPServer.new( :Port => $port, :DocumentRoot => Dir::pwd ) p $s[:MaxClients] $s.mount('/sleep', SleepServer) $s.mount('/greet', GreetServer) trap("INT"){ $s.shutdown } $s.start