--- Yohanes Santoso wrote:
Funny, I do not observe that behaviour:
On my XP system here, with:
WEBrick 1.3.1
ruby 1.8.2 (2004-06-29) [i386-mswin32]
I get the following from your script (slightly modified; i'll post below
for completeness) from three requests started as close to the same time as
I could manage:
Req1:
Start: Tue Aug 31 14:50:30 Eastern Daylight Time
2004
End: Tue Aug 31 14:50:40 Eastern Daylight Time 2004
Req2:
Start:
Tue Aug 31 14:50:40 Eastern Daylight Time 2004
End: Tue Aug 31 14:50:50 Eastern
Daylight Time 2004
Req3:
Start: Tue Aug 31 14:50:50 Eastern Daylight Time
2004
End: Tue Aug 31 14:51:00 Eastern Daylight Time 2004
Looks like they're
blocking each other pretty perfectly, eh?
I've also added output of the
server's :MaxClients just to be sure... but it returns "100", as it should
by default.
Any Ideas? I'll post the script below just to ensure I didn't
break anything in making it run...
-Ryan
PS - Sorry about the poor formatting
on my emails, I'm reading the list through Bloglines lately... maybe I should
switch back to receiving all the messages...
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