[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4.3 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 */

[ Previous | Next | Contents | Glossary | Home | Search ]