J
Jack
Just go through ruby cookbook & only tutorial for any DRb stuff. But I
need help explain below example that I don't understand why DRbUndump
is not needed. On some of the samples, I see class definition is
defined in a separate file and was 'require' by both client & server.
But in this case, the class definition is embedded in server side
code.
The below code works. I would think variable 'ro' in client represent
a proxy. So on the server side, the class definiton probably need to
include DRbUndump. Can anyone explain to my confusion?
# client
require 'drb'
DRb.start_service
ro = DRbObject.new(nil, 'druby://localhost:7777')
print ro.songname
#server
#!/usr/local/bin/ruby
require 'drb'
class SongNameServer
def initialize(str)
@filename = str
end
def songname
f = File.new(@filename)
return f.readline
end
end
DRb.start_service("druby://localhost:7777", SongNameServer.new("/tmp/
songname"))
puts DRb.uri
DRb.thread.join
need help explain below example that I don't understand why DRbUndump
is not needed. On some of the samples, I see class definition is
defined in a separate file and was 'require' by both client & server.
But in this case, the class definition is embedded in server side
code.
The below code works. I would think variable 'ro' in client represent
a proxy. So on the server side, the class definiton probably need to
include DRbUndump. Can anyone explain to my confusion?
# client
require 'drb'
DRb.start_service
ro = DRbObject.new(nil, 'druby://localhost:7777')
print ro.songname
#server
#!/usr/local/bin/ruby
require 'drb'
class SongNameServer
def initialize(str)
@filename = str
end
def songname
f = File.new(@filename)
return f.readline
end
end
DRb.start_service("druby://localhost:7777", SongNameServer.new("/tmp/
songname"))
puts DRb.uri
DRb.thread.join