Writing a Server Program
This page explains how to write a server program that uses SHRIMP RPC.
First, create an interface definition file, written in SIDL, and run the stub-generator on it to produce an include-file,
a client C file, and a server C file.
Suppose you're implementing the foo service. After running foo.x
through the stub generator, you'll have three files, foo_rpc.h,
foo_clnt.c, and foo_serv.c.
Your server program should #include foo_rpc.h. You should
compile foo_serv.c into foo_serv.o, and link
foo_serv.o with your server program and with the SRPC
library, /u/shrimp/lib/libsrpc.a. (When compiling, use the
-I/u/shrimp/include switch so the compiler can find the SRPC include
Servicing Remote Calls
Before a server program can accept calls from a remote client, it
must first create a SrpcSrvBinding to
represent the connection to that client. A separate SrpcServBinding
is needed for each client that the server program will serve.
The SRPC library automatically maintains a list of all existing
SrpcServBindings. When you call
the library will check each binding. For each binding, if the client
is attempting an RPC, the library will service that RPC. (If the
client is not attempting an RPC, the library immediately goes on to
the next client.) Once each SrpcServBinding has been checked,
srpcServerPoll completes, returning the number of RPCs that