Skip to content

Instantly share code, notes, and snippets.

@adamgamble
Created June 18, 2012 13:42
Show Gist options
  • Save adamgamble/2948434 to your computer and use it in GitHub Desktop.
Save adamgamble/2948434 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'dcell'
class TimeServer
include Celluloid
def time
"The time is: #{Time.now}"
end
end
class FileServer
include Celluloid
SHARE_DIRECTORY = File.join(File.expand_path(File.dirname(__FILE__)), "share")
def list
Dir.entries(SHARE_DIRECTORY)
end
def read(file_name = "")
File.read(File.join(SHARE_DIRECTORY, file_name))
end
end
DCell.start :id => "desktop", :addr => "tcp://192.168.1.74:2042"
TimeServer.supervise_as :time_server
FileServer.supervise_as :file_server
while true do
sleep 1
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment