aboout DRb...

J

Jun Young Kim

[Note: parts of this message were removed to make it a legal post.]

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?
 
J

Jun Young Kim

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

.....
 
A

Ammar Ali

Jun said:
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

.....
return is a keyword, it is returning after def.
 
J

Jun Young Kim

please, skip the syntaxes. I rewrite codes to explain about my problem
simply. :)
 
J

Jun Young Kim

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.

2009. 06. 29, =BF=C0=C0=FC 10:04, Jun Young Kim =C0=DB=BC=BA:
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 =3D 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 =3D DRbObject.new(nil, uri)

buffer =3D 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 =20=
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,231
Members
46,820
Latest member
GilbertoA5

Latest Threads

Top