1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

2000-06-22

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@775 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2000-06-22 08:29:58 +00:00
parent 4b4cad81e7
commit 44cf56d6e7
19 changed files with 196 additions and 76 deletions

View file

@ -2,7 +2,6 @@
# usage: ruby tsvr.rb
require "socket"
require "thread"
gs = TCPserver.open(0)
addr = gs.addr
@ -10,10 +9,8 @@ addr.shift
printf("server is on %d\n", addr.join(":"))
while TRUE
ns = gs.accept
print(ns, " is accepted\n")
Thread.start do
s = ns # save to thread-local variable
Thread.start(gs.accept) do |s|
print(s, " is accepted\n")
while s.gets
s.write($_)
end