Last active
August 29, 2015 14:05
-
-
Save champierre/1faa7905906d8e309822 to your computer and use it in GitHub Desktop.
pry message from scratch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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