Network Programming 2000

Project 5 - RPC
Frequently Asked Questions

Questions:
compiling on AIX Linking on a Sun Sun Server is a Daemon
Q: The sample RPC programs don't compile under AIX

A:On AIX you need to do the following:

  • add #include to all your files. Other versions of rpcgen put this include in the generated .h file, rpcgen on AIX doesn't.

  • rename the remote procedure that you write by removing the "_svc", so for the linkedlist example you need to change llservice.c so that it contains the definition of sum_1 and not sum_1_svc. This is the older naming scheme (it used to be this way on Suns and other machines).
Q: The sample RPC programs don't link on a Sun.

A:On a Sun (Solaris) you need to add some libraries:

  • The server needs "-lrpcsvc -lnsl"
  • The client needs "-lnsl"
Q: OK - I got a server built on a Sun, but when I run the server it does nothing - it just quits. What's up with that?

A:By default, a server based on rpcgen generated code will become a daemon process by forking and having the parent exit. You can turn this off by defining the symbol RPC_SVC_FG when compiling your server (look in the _svc to see how this changes things in the server main). You can define a symbol via a command line option to the compiler by adding this "-DRPC_SVC_FG" to the compile command for the rpcgen generated _svc file. You can also change the header file generated by rpcgen, but this is not a good idea since rerunning rpcgen will overwrite the header file.

To find and get rid of a daemon process you need to use the ps command and the kill command - here is an example that finds a process that was started by running the program ./test:

> /usr/ucb/ps aux | grep test
hollingd  9722  0.2  0.6 2040 1512 ?        S 10:30:39  0:00 ./test
> kill -9 9722