DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Developing distributed applications using ONC RPC and XDR

Using the highest layer

Suppose you are writing a program that needs to know how many users are logged into a remote machine. You might do this by calling a library routine named rnusers, as illustrated here:

   #include <stdio.h>
   

main(argc, argv) int argc; char **argv; { unsigned 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); }

The rnusers routine is not included with this release of the software, but is shown as an example only.

The program above could be compiled with:

cc program.c -lrpcsvc -lsocket


Next topic: Using the intermediate layer
Previous topic: Using remote procedure calls

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003