[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Communications Programming Concepts

Using the Highest Layer of RPC Example

The following example shows how a program calls the Remote Procedure Call (RPC) library rnusers routine to determine how many users are logged in to a remote workstation:

#include <stdio.h>
main(argc, argv)
    int argc;
    char **argv;
{
    int num;
           if (argc != 2) {
                 fprintf(stderr, "usage: rnusers hostname\n");
                 exit(1);
           }
           if ((num = rnusers(argv[1])) < 0) {
                  fprintf(stderr, "error: rnusers\n");
                  exit(-1);
           }
           printf("%d users on %s\n", num, argv[1]);
           exit(0);
}
/* to compile: cc -o rnusers rnusers.c -lrpcsvc */

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]