Next: , Previous: Implementation of ONC RPC, Up: Implementation of ONC RPC

4.3.1 Building an RPC Client

Basic building blocks for the creation of RPC clients are provided by the (rpc rpc) module. The easiest way to build an RPC client is through make-synchronous-rpc-call.

— Scheme Procedure: make-synchronous-rpc-call program version procedure arg-type result-type

Return a procedure that may be applied to a list of arguments, transaction ID (any unsigned number representable on 32 bits), and I/O port, to make a synchronous RPC call to the remote procedure numbered procedure in program, version version. On success, the invocation result is eventually returned. Otherwise, an error condition is raised. arg-type and result-type should be XDR type objects (see XDR Type Representations).

Error conditions that may be raised include those related to XDR encoding and decoding (see XDR Encoding and Decoding), as well as RPC-specific error conditions inheriting from &rpc-error (i.e., conditions that pass the rpc-error? predicate). These are detailed in assert-successful-reply.

For an example, see Creating the Client.

It is also possible to create “one-way” calls, i.e., RPC calls that do not expect a reply (i.e., no return value, not even void). This is useful, for instance, to implement batched calls where clients do not wait for the server to reply (see Section 7.4.1 of RFC 1831). Asynchronous calls can be implemented in terms of this, too.

— Scheme Procedure: make-one-way-rpc-call program version procedure arg-type result-type

Similar to make-synchronous-rpc-call, except that the returned procedure does not wait for a reply.