Skip to content

Instantly share code, notes, and snippets.

@gomasy
Last active August 29, 2015 13:57
Show Gist options
  • Save gomasy/9550708 to your computer and use it in GitHub Desktop.
Save gomasy/9550708 to your computer and use it in GitHub Desktop.
require "socket"
socket = TCPServer.open(4545)
loop do
Thread.new(socket.accept) do |s|
str = ""
loop do
num = rand(6).to_s
s.write(num)
str << num
break if str =~ /114514/
end
s.close
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment