#! /usr/bin/ruby
require 'socket'      
s = TCPSocket.open('localhost', 2000)

loop do
  s = TCPSocket.open('localhost', 2000)
    input = gets.chop
    s.puts input
    if  input == "exit"
        puts "Exit"
        s.close
        break
    else
        puts s.recv(100)
    end
end
