diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-06-22 08:29:58 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-06-22 08:29:58 +0000 |
commit | 44cf56d6e70dbe06a160b004494ba40dd4cfb426 (patch) | |
tree | 10e665c60414c3070ce957e5c534e30ed499bc2d /sample/tsvr.rb | |
parent | 4b4cad81e7d2bdc4750ea5043ce44bf37adb3997 (diff) |
2000-06-22
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@775 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'sample/tsvr.rb')
-rw-r--r-- | sample/tsvr.rb | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/sample/tsvr.rb b/sample/tsvr.rb index d6a5620d11..ebfad4beeb 100644 --- a/sample/tsvr.rb +++ b/sample/tsvr.rb @@ -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 |