Programming with Remote Procedure Calls (RPC)

Programming using the rpcgen command

The details of programming applications to use Remote Procedure Calls can be overwhelming. Perhaps the most daunting task is writing the XDR routines that are necessary to convert procedure arguments and results into XDR format and back again.

The rpcgen(ADMN) compiler helps you write RPC applications simply and directly. It does most of the dirty work, allowing you to debug the main features of your application, instead of requiring you to spend most of your time developing transport interface code.

rpcgen accepts as input a remote program interface definition written in the RPC Language, which is similar to C. rpcgen outputs C language code that is suitable for RPC programs. This output includes:

rpcgen's output files can be compiled and linked in the usual way.

The client stubs interface with the RPC library and effectively hide the transport from their callers. The server skeleton similarly hides the transport from the server procedures that are to be invoked by remote clients.

The developer writes server procedures (in any language that observes system calling conventions) and links them with the server skeleton produced by rpcgen to get an executable server program. To use a remote program, the programmer writes an ordinary main program that makes local procedure calls to the client stubs produced by rpcgen. Linking this program with stubs produced by rpcgen creates an executable program. (At present, the main program must be written in C.)

rpcgen options can be used to suppress stub generation and to specify the transport to be used by the server skeleton.

rpcgen reduces the development time that would otherwise be spent coding and debugging low-level routines, at a small cost in efficiency and flexibility. For speed-critical applications, though, rpcgen allows programmers to mix low-level code with high-level code. Hand-written routines can be linked with the rpcgen output without any difficulty. Also, one may proceed by using rpcgen output as a starting point, and then rewriting it as necessary. (For a discussion of RPC programming without rpcgen, see ``Remote Procedure Call programming'').

rpcgen allows you to do such things as:

``Common RPC programming techniques'' suggests some coding and usage techniques for rpcgen.

``RPC language reference'' provides a complete description of the RPC programming language recognized by rpcgen.

© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005