Sha256: 492854b294c32f696d586d51bfda42b50b050837f4ce1fb56da3efee3de6c7fa
Contents?: true
Size: 1.06 KB
Versions: 1
Compression:
Stored size: 1.06 KB
Contents
#!/usr/bin/env ruby -w # Copyright (C) 2004-2007 Kouichirou Eto, All rights reserved. # License: Ruby License $LOAD_PATH.unshift("..") if !$LOAD_PATH.include?("..") require "sgl/sgl-connect" module Sgl class Puts def initialize(stream=$stdout) stream.sync = true @stream = stream end def puts(str) @stream.puts(str) end end class Server def self.main(argv) server = self.new server.run end def run(duration=0) uri = DEFAULT_URI DRb.start_service(uri, Puts.new) puts DRb.uri if duration == 0 sleep else sleep duration end end end end if $0 == __FILE__ require "test/unit" $__test_sgl__ = true end if defined?($__test_sgl__) && $__test_sgl__ class TestSglServer < Test::Unit::TestCase #:nodoc: def test_all server = Sgl::Server.new Thread.start { server.run(5) } uri = Sgl::DEFAULT_URI there = DRbObject.new_with_uri(uri) there.puts('Hello, World.') end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sgl-1.0.0 | lib/sgl/sgl-server.rb |