Skip to content

Instantly share code, notes, and snippets.

@mebens
Created January 28, 2011 04:53
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 mebens/799850 to your computer and use it in GitHub Desktop.
Save mebens/799850 to your computer and use it in GitHub Desktop.
A very simple Ruby server setup.
require 'gserver'
class MyServer < GServer
def initialize(port=12345, *args)
super(port, *args)
end
def serve(io)
io.puts("The time is currently #{Time.now}")
end
end
server = MyServer.new
server.audit = true # logging on
server.start
while GServer.in_service?(12345)
# hit Ctrl+C to stop
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment