Hi. all
quick question
I received a drb object from an another process.
let me see an example.
sender class)
A class)
…
def return
ret = output.new(self)
…
ret
end
B class)
@@buffer
def buffer(buf)
@@buffer << buf
end
def send
DRb.start_service(nil, self)
…
DRb.stop_service
end
def wait_ret
@@buffer
end
receiver class)
DRb.start_service
…
tObj = DRbObject.new(nil, uri)
buffer = tObj.wait_ret
STDOUT.write buffer
DRb.stop_service
in this code,
when i write buffer in stdout, it is appeared by sequences of output
class.
but, when i puts buffer in stdout, it is appeared always by sequences
of DRb::unknown or DRb::Object.
I cannot call methods of buffer class(this is an instance of output
class).
could you give me hints to understand this situation?
code should be like this .
sender class)
A class)
…
def return
ret = output.new(self)
…
B.buffer(ret)
end
B class)
@@buffer
def self.buffer(buf)
@@buffer << buf
end
def send
DRb.start_service(nil, self)
…
DRb.stop_service
end
…
Jun Y. Kim wrote:
end
…
DRb.stop_service
end
…
return is a keyword, it is returning after def.
Ammar A. wrote:
B.buffer(ret)
DRb.start_service(nil, self)
Never mind that. Completely wrong. Sorry.
please, skip the syntaxes. I rewrite codes to explain about my problem
simply.
I got the answer
we should defined output class both of classes (server and client).
If we didn’t defined it in both of them, the same case will be happen.
The another way to solve this problem is using DrbUndumped.
When you specify this this in output class like
class output
include DRbUndumped
…
end
you can receive the instances of class normally.
anyway, I hope the other person solve this problem easily.
-
- 29, ¿ÀÀü 10:04, Jun Y. Kim ÀÛ¼º: