box-o-sand/ruby-sockets/ping-pong/client.rb
2012-06-16 00:15:39 -04:00

12 lines
192 B
Ruby

require 'socket'
loop do
TCPSocket.open('127.0.0.1', 24000) do |sock|
sock.send("PING\n", 0)
pong = sock.recv(100)
puts "client: RECV PONG"
sock.close
end
sleep 0.5
end