From: "dongcan z." Date: 2012-06-11T12:31:01+09:00 Subject: Re: about using drb to read data Robert Klemme wrote in post #1063691: > On Fri, Jun 8, 2012 at 5:15 AM, dongcan z. wrote: >> In my codes , I use drb to read data from a pipe. I want to read the > > AFAIK DRb uses sockets and not pipes... > >> 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 - (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. > > Can you show the code? Otherwise it will be difficult to help. > > Kind regards > > robert The code is like this: #in the server ######################## class Drb_server include DRb::DRbObservable def initialize out @pipe= out end def invoke_client while line=@pipe.gets changed notify_observers(line) end end end #The class below is a class that calls class Drb_server and output data #through a pipe class Main def start @s_out=IO.popen(...a command line that can execute) d_server=DRb_server.new @s_out DRb.start_service(uri,d_server) end def info_output while str_line=@s_out.gets puts str_line end end end #Next is the execute codes task=Main.new task.start task.info_output #################### #in the drb client require 'drb/drb' class Show include DRbUndumped def update(value) puts value end end monitor=DRbObject.new_with_uri(server_uri) shower=Show.new monitor.add_observer(shower) monitor.invoke_client I want to output the see the output both in server and in the client.But this can not success. So I wonder if you can give me some suggestions. Thank you! -- Posted via http://www.ruby-forum.com/.