Skip to content

Instantly share code, notes, and snippets.

@ChunChunMorning
Created December 5, 2016 05:12
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 ChunChunMorning/f6f3e8141ee5697e2173d962a69cfac9 to your computer and use it in GitHub Desktop.
Save ChunChunMorning/f6f3e8141ee5697e2173d962a69cfac9 to your computer and use it in GitHub Desktop.
require "socket"
server = TCPServer.open("127.0.0.1", 50000);
puts "Server is running at 50000."
loop {
begin
parent = server.accept();
# 省略
threads.each { |thread|
thread.join();
}
rescue
parent.close();
child.close();
puts("Game End");
end
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment