Skip to content

Instantly share code, notes, and snippets.

@lucasmartins
Created October 24, 2012 13:34
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 lucasmartins/3946077 to your computer and use it in GitHub Desktop.
Save lucasmartins/3946077 to your computer and use it in GitHub Desktop.
Ruby TCPServer with 'persistent' connection
require 'socket'
server = TCPServer.open(6060)
loop {
client = server.accept
loop {
buffer = client.gets()
if buffer.nil?
buffer.close
break
end
puts line
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment