require "socket" def testTCPServer server = TCPServer.new 2000 # Server bound to port 2000 loop do client = server.accept # Wait for a client to connect client.puts "Hello !" client.puts "Some thing from Server" puts client.gets client.close end end testTCPServer