DCE for the HP e3000 (B3821-90003)

55
7 Programming with RPC 1.2.1 on
MPE/iX
This chapter explains the RPC application programming with a small
example. The example consists of server and client components. The
client makes a RPC request to the server and asks the server to sleep
for a speciļ¬ed amount of time. The server serves this request from the
client by going to sleep for the time given by the client.
/* client.c
************************************************************************************
* This is the sleeper client program.It takes two arguments, a hostname to contact
* for the server and a number of seconds to sleep. The client locates the server
* using the hostname provided and the endpoint mapper on the server's host -- the
* client does not contact the name service for server location information. The
* client uses the explicit binding method, so it uses th hostname argument to
* construct a binding handle (rpc_binding_handle_t).The client passes this binding
* handle to the invocation of the remote procedure.
************************************************************************************
*/
/*
* (c) Copyright 1992, 1993, 1994 Hewlett-Packard Co.
*/
/*
* @(#)HP DCE/3000 @(#)Module: client.c
*/
#include <stdlib.h> /* Standard POSIX defines */
#include <strings.h> /* str*() routines */
#include <stdio.h> /* Standard IO library */
#include <dce/dce_error.h> /* DCE error facility */
#include <pthread.h> /* DCE Pthread facility */
#include "common.h" /* Common defs for this app */
#include "sleeper.h" /* Output from sleeper.idl */
#ifdef TRACING
tr_handle_t *tr_handle = NULL; /* Initialize for client */
#endif /* TRACING */