-
-
Save danvideo/111f10b249a24a6bc0037ea7d509ee9a to your computer and use it in GitHub Desktop.
Ruby TCP Server
This file contains hidden or 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
require 'socket' | |
server = TCPServer.open(3010) # Socket to listen on port | |
loop do # Servers run forever | |
Thread.start(server.accept) do |client| | |
puts "client connected" | |
#do stuff | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment