🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.windows.interviews
Article #1053

Re: Rpc question

#1053
From: John Interrante
Date: Fri, 03 May 1991 00:58
29 lines
1395 bytes
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
Technical Details
Message-ID: <INTERRAN.91May2205819@lurch.Stanford.EDU>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!samsung!uunet!stanford.edu!cascade.stanford.edu!cascade!interran
References: <2143.9105011548@encore.encore.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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: <INTERRAN.91May2205819@lurch.Stanford.EDU>
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