⚲
Project
General
Profile
Sign in
Register
Home
Projects
Help
Search
:
Ruby master
All Projects
Ruby
»
Ruby master
Overview
Activity
Roadmap
Issues
Repository
Like
Download (588 Bytes)
Bug #11482
» server.rb
s_p_oneil (Sean O'Neil)
, 08/24/2015 03:21 PM
require
'webrick'
servers
=
[]
threads
=
[]
10
.
times
{
|
i
|
threads
<<
Thread
.
new
{
begin
root
=
File
.
expand_path
(
'D:/Test'
)
server
=
WEBrick
::
HTTPServer
.
new
({
:DocumentRoot
=>
root
,
:Port
=>
8000
+
i
,
:MaxClients
=>
20
,
:RequestTimeout
=>
60
,
:DoNotReverseLookup
=>
true
,
:AccessLog
=>
[]
})
server
.
mount_proc
(
'/'
)
{
|
req
,
res
|
res
.
body
=
'Hello, world!'
100
.
times
{
|
i
|
res
.
body
<<
' '
}
}
servers
<<
server
server
.
start
rescue
Exception
puts
(
"Woops:
#{
$!
.
to_s
}
"
)
retry
end
}
}
threads
.
each
{
|
t
|
t
.
join
}
« Previous
1
2
3
Next »
(2-2/3)
Loading...