-
-
Save rhenium/48aeae2049feb746f210 to your computer and use it in GitHub Desktop.
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
$port = 10000 | |
require "socket" | |
server = TCPServer.open($port) | |
loop do | |
Thread.start(server.accept) do |cli| | |
puts "connected: " + cli.__id__.to_s | |
while line = cli.gets | |
puts cli.__id__.to_s + ": " + line.chomp | |
end | |
cli.close | |
puts "disconnected: " + cli.__id__.to_s | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment