added a test echo client

This commit is contained in:
Jeena Paradies 2011-01-25 13:28:51 +01:00
parent 719aa36b03
commit a44a538ac6

18
echo_test.rb Normal file
View file

@ -0,0 +1,18 @@
#!/usr/bin/env ruby -wKU
require 'socket' # Sockets are in standard library
hostname = 'localhost'
port = 7000
s = TCPSocket.open(hostname, port)
print "What to echo? "
q = gets
s.print(q)
while true
line = s.gets # Read lines from the socket
puts "Got Echo: " + line.chop # And print with platform line terminator
end
s.close # Close the socket when done