Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.