Skip to content

Instantly share code, notes, and snippets.

@melito
Created February 17, 2011 18:55
Show Gist options
  • Save melito/832365 to your computer and use it in GitHub Desktop.
Save melito/832365 to your computer and use it in GitHub Desktop.
require "socket"
server = TCPServer.new('0.0.0.0', 6969)
loop do
socket = server.accept
Thread.start do
s = socket
while line = s.gets
s.puts(`echo #{line}`)
# FOR EXPERTS ONLY
# Ruby has this really awesome method called REVERSE
# I think it's on the object class. It turns your objects UPSIDE DOWN
# USE WITH CAUTION
# s.puts(`echo #{line}`.reverse)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment