OSF DCE Application Development Guide--Core Components
OSF DCE Application Development Guide—Core Components
/*
* greet_client.c
*
* Client of "greet" interface.
*/
#include <stdio.h>
#include <dce/rpc.h>
#include "greet.h"
#include "util.h"
int
main(
int argc,
char *argv[]
)
{
rpc_ns_handle_t import_context;
handle_t binding_h;
error_status_t status;
idl_char reply[REPLY_SIZE];
if (argc < 2) {
fprintf(stderr, "usage: greet_client <CDS pathname>\n");
exit(1);
}
/*
* Start importing servers using the name specified
* on the command line.
*/
rpc_ns_binding_import_begin(
rpc_c_ns_syntax_default, (unsigned_char_p_t) argv[1],
greetif_v1_0_c_ifspec, NULL, &import_context, &status);
ERROR_CHECK(status, "Can’t begin import");
/*
* Import the first server (we could iterate here,
* but we’ll just take the first one).
*/
rpc_ns_binding_import_next(import_context, &binding_h, &status);
ERROR_CHECK(status, "Can’t import");
/*
* Make the remote call.
*/
greet(binding_h, (idl_char *) "hello, server", reply);
printf("The Greet Server said: %s\n", reply);
}
The module first includes greet.h, the header file for the greet interface generated by the
IDL compiler.
11 − 18 Tandem Computers Incorporated 124245