PreviousNext

greet_dced_client.c

Following are the contents of the greet_dced_client.c file.

/*

* greet_dced_client.c

*

* Client of "greet_dced" interface.

*/

#include <stdio.h>

#include <dce/nbase.h>

#include <dce/rpc.h>

#include "greet_dced.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_dced_client <CDS pathname>\en");

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],

greet_dcedif_v1_0_c_ifspec, NULL, &import_context, &status);

ERROR_CHECK(status, "Can't begin import");

/*

* Import the first server (we could interate 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_dced(binding_h, (idl_char *) "hello, server", reply);

printf("The Greet Server said: %s\en", reply);

}