Using remote procedure calls
Programs that communicate over a network
need a paradigm for communication.
The method used by the NFS is the Remote Procedure Call
(RPC)
paradigm, in which a client communicates
with a server. In this process, the client first calls a
procedure to send a request to the server. When the packet
containing the request arrives, the server calls a dispatch
routine, performs the service requested, sends back the reply,
and the procedure call returns to the client.
You can think of the
RPC
interface as divided into three layers.
-
The highest layer is totally transparent.
For example,
at this level, a program can contain a call to
rnusers,
which returns the number of users on a remote machine.
You do not need to be aware that RPC
is being used, because you make the call in a program,
just as you might call malloc.
-
The middle-layer routines are designed for most common applications
and shield you from needing to know about sockets.
At this layer, the routines registerrpc
and callrpc
are used to make RPC calls:
registerrpc
obtains a unique system-wide number, while
callrpc executes a remote procedure call.
The rnusers
call is implemented using these two routines.
-
The lowest layer is used for more sophisticated applications
that may alter the defaults of the routines.
At this layer, you can explicitly manipulate
sockets used for transmitting RPC messages.
As a general rule, you should use the highest layer you need,
and avoid the lower layers unless you must access some
functionality they provide.
Although this document discusses only the interface to C,
remote procedure calls can be made from any language.
Moreover, although this document discusses RPC
when used to communicate between processes running on different machines,
it works just as well for communication
between processes running on the same machine.
NOTE:
The examples shown on the following pages illustrate the capabilities of
RPC, but are not meant for actual use on your SCO OpenServer system.
This is because the rnusers routine that the examples rely on is
not included with the SCO OpenServer operating system.
Next topic:
Using the highest layer
Previous topic:
Compiling RPC code
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003