# prac0804.rb
# 入出力クライアント
# キーボード入力があれば、それをサーバに送り、
# サーバから返信があれば、それを画面に表示する。
require 'socket'
hostname = Socket::gethostname
port = 3456
cs = TCPSocket.open(hostname,port)
loop do
inputs = IO.select([$stdin,cs])
if inputs != nil
if inputs[0][0] == $stdin
cs.puts $stdin.gets.chomp
else
puts cs.gets.chomp
end
end
end