summaryrefslogtreecommitdiff
path: root/sample/svr.rb
diff options
context:
space:
mode:
Diffstat (limited to 'sample/svr.rb')
-rw-r--r--sample/svr.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/sample/svr.rb b/sample/svr.rb
index 91faa56dd8a..23b2bf71f67 100644
--- a/sample/svr.rb
+++ b/sample/svr.rb
@@ -2,7 +2,9 @@
# usage: ruby svr.rb
gs = TCPserver.open(0)
-printf("server port is on %d\n", gs.port)
+addr = gs.addr
+addr.shift
+printf("server is on %d\n", addr.join(":"))
socks = [gs]
while TRUE
@@ -10,7 +12,9 @@ while TRUE
if nsock == nil; continue end
for s in nsock[0]
if s == gs
- socks.push(s.accept)
+ ns = s.accept
+ socks.push(ns)
+ print(s, " is accepted\n")
else
if s.eof
print(s, " is gone\n")