Skip to content

Instantly share code, notes, and snippets.

@ymurase
Created November 15, 2014 08:09
Show Gist options
  • Save ymurase/5f33afd3aa32da3aa13c to your computer and use it in GitHub Desktop.
Save ymurase/5f33afd3aa32da3aa13c to your computer and use it in GitHub Desktop.
A sample of TCP client implemented by Ruby.
require 'socket'
sock = TCPSocket.open("127.0.0.1", 31400)
5.times do
sock.write("ping\n")
$stdout.puts "sent"
puts sock.gets
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment