Skip to content

Instantly share code, notes, and snippets.

@sters
Created February 3, 2020 14:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sters/769ec1e023867ee02ecbee596f4da9a4 to your computer and use it in GitHub Desktop.
Save sters/769ec1e023867ee02ecbee596f4da9a4 to your computer and use it in GitHub Desktop.
rst_server.rb
require "socket"
gs = TCPServer.open(20000)
addr = gs.addr
addr.shift
printf("server is on %s\n", addr.join(":"))
while true
Thread.start(gs.accept) do |s|
# is this correct...?
s.sendmsg("", 0x04)
sleep(1)
s.close
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment