From: James Edward Gray II Date: 2005-09-29T02:26:04+09:00 Subject: Re: Newbie dumb question regarding GServer On Sep 28, 2005, at 12:11 PM, Mike Pence wrote: > Hello all, Howdy. > Great to be here. Ruby is re-igniting my love of software development. Glad to hear it. > I am running this code: > > require 'gserver' > > # > # A server that returns the time in seconds since 1970. > # > class TimeServer < GServer > def initialize(port=10001, *args) > super(port, *args) > end > def serve(io) > io.puts(Time.now.to_i) > end > end > > # Run the server with logging enabled (it's a separate thread). > server = TimeServer.new > server.audit = true # Turn logging on. > server.start We should probably update that example in the documentation. I'm sure we could do better. > And getting this output: > > [Wed Sep 28 12:40:24 2005] TimeServer 127.0.0.1:10001 start > [Wed Sep 28 12:40:28 2005] TimeServer 127.0.0.1:10001 stop > > Why is the server stopping? GServer runs in its own Threads. But your main program is just starting it and then ending. You need to ask it to wait on the server. Add the following line at the end of your script: server.join # wait on server... Hope that helps. Welcome to Ruby! James Edward Gray II