summaryrefslogtreecommitdiff
path: root/sample/clnt.rb
diff options
context:
space:
mode:
Diffstat (limited to 'sample/clnt.rb')
-rw-r--r--sample/clnt.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/sample/clnt.rb b/sample/clnt.rb
index 4f96ca4089..0f3d17bf19 100644
--- a/sample/clnt.rb
+++ b/sample/clnt.rb
@@ -3,15 +3,19 @@
require "socket"
-host=(if ARGV.length == 2; ARGV.shift; else "localhost"; end)
+if ARGV.length >= 2
+ host = ARGV.shift
+else
+ host = "localhost"
+end
print("Trying ", host, " ...")
STDOUT.flush
s = TCPSocket.open(host, ARGV.shift)
print(" done\n")
print("addr: ", s.addr.join(":"), "\n")
print("peer: ", s.peeraddr.join(":"), "\n")
-while gets()
- s.write($_)
+while line = gets()
+ s.write(line)
print(s.readline)
end
s.close