Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!samsung!uunet!stanford.edu!cascade.stanford.edu!cascade!interran From: interran@lurch.Stanford.EDU (John Interrante) Newsgroups: comp.windows.interviews Subject: Re: Rpc question Message-ID: Date: 3 May 91 00:58:19 GMT References: <2143.9105011548@encore.encore.com> Sender: news@cascade.Stanford.EDU (USENET News System) Organization: Stanford University Lines: 29 In-Reply-To: weiss@ENCORE.COM's message of 1 May 91 15:48:43 GMT Yes, you can send back a return value to the caller. You need something like this (I/O error checking omitted): // Program sending a RPC call. int DerivedRpcWriter::foobar(int data) { int reply; server() << RpcHdr(FOOBAR) << data; server() >> reply; return reply; } // Another program receiving the RPC call and replying to it. This // function is a static member function (no 'this'), so that's why // client and everything else is passed in as arguments. void DerivedRpcReader::foobar(RpcReader*, RpcHdr&, rpcstream& client) { int data, reply; client >> data; ... client << reply << flush; } I haven't had time to start using the Dispatch library in a new project, so I don't have a more complete example yet. -- John Interrante / interran@lurch.stanford.edu