Skip to content

Instantly share code, notes, and snippets.

@champierre
Last active August 29, 2015 14:05
Show Gist options
  • Save champierre/1faa7905906d8e309822 to your computer and use it in GitHub Desktop.
Save champierre/1faa7905906d8e309822 to your computer and use it in GitHub Desktop.
pry message from scratch
# TCPSocket を使うため socket ライブラリを読み込みます
require "socket"
# localhost の TCP 番号 42001 番に接続します
socket = TCPSocket.open("localhost", 42001)
loop do
# 十分な長さのメッセージを読み取る
message = socket.recv(100)
# バイトで表示
puts message.unpack("H*")[0]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment