add it to client.
----
 shower=3DShow.new
+DRb.start_service
 monitor.add_observer(shower)
----


On 2012/06/11, at 12:31, "dongcan z." <lists / ruby-forum.com> wrote:

> Robert Klemme wrote in post #1063691:
>> On Fri, Jun 8, 2012 at 5:15 AM, dongcan z. <lists / ruby-forum.com> wrote:
>>> In my codes , I=1B$B!!=1B(Buse drb to read data from a pipe. I want to r=
ead the
>>=20
>> AFAIK DRb uses sockets and not pipes...
>>=20
>>> pipe data and let them show in client as well as in server. But it
>>> cannot done successfully.The results show the pipe date will be splitted=

>>> in server point and client point,and always error "dmon.rb:63:in
>>> `write': Broken pipe - <STDOUT> (Errno::EPIPE)". I google this issue
>>> ,and it says pipe data cannot read more than once. So I ask for help in
>>> this platform. I need your help.Thank you.
>>=20
>> Can you show the code?  Otherwise it will be difficult to help.
>>=20
>> Kind regards
>>=20
>> robert
>=20
> The code is like this:
> #in the server
> ########################
> class Drb_server
>  include DRb::DRbObservable
>  def initialize out
>    @pipe=3D out
>  end
>  def invoke_client
>    while line=3D / pipe.gets
>      changed
>      notify_observers(line)
>    end
>  end
> end
> #The class below is a class that calls class Drb_server and output data=20=

> #through a pipe
> class Main
>  def start
>    @s_out=3DIO.popen(...a command line that can execute)
>    d_server=3DDRb_server.new @s_out
>    DRb.start_service(uri,d_server)
>  end
>  def info_output
>    while str_line=3D / s_out.gets
>      puts str_line
>    end
>  end
> end
> #Next is the execute codes
> task=3DMain.new
> task.start
> task.info_output
>=20
> ####################
> #in the drb client
> require 'drb/drb'
> class Show
>  include DRbUndumped
>  def update(value)
>    puts value
>  end
> end
> monitor=3DDRbObject.new_with_uri(server_uri)
> shower=3DShow.new
> monitor.add_observer(shower)
> monitor.invoke_client
>=20
>=20
>=20
>=20
>=20
> I want to output the see the output both in server and in the client.But=20=

> this can not success. So I=1B$B!!=1B(Bwonder if you can give me some sugge=
stions.=20
> Thank you!
>=20
> --=20
> Posted via http://www.ruby-forum.com/.