home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
World_Of_Computer_Software-02-385-Vol-1of3.iso
/
r
/
rem-file.zip
/
remote_file
/
r_server.c
< prev
next >
Wrap
C/C++ Source or Header
|
1992-06-03
|
3KB
|
63 lines
/* FILE NAME: r_server.c */
#include <stdio.h>
#include "remote_file.h" /* header created by the idl compiler */
#include "check_status.h" /* contains the CHECK_STATUS macro */
main ()
{
unsigned32 status; /* error status (nbase.h) */
rpc_binding_vector_t *binding_vector; /* binding handle list (rpcbase.h)*/
rpc_server_register_if( /* register interface with the RPC runtime */
remote_file_v1_0_s_ifspec, /* handle for interface specification */
NULL,
NULL,
&status /* error status */
);
CHECK_STATUS(status, "Can't register interface\n", ABORT);
rpc_server_use_all_protseqs( /* establish protocol sequences */
rpc_c_protseq_max_reqs_default, /* queue length for remote calls */
&status
);
CHECK_STATUS(status, "Can't establish protocol sequences\n", ABORT);
rpc_server_inq_bindings( /* get set of this server's binding handles */
&binding_vector,
&status
);
CHECK_STATUS(status, "Can't get binding handles\n", ABORT);
rpc_ep_register( /* add endpoint to local endpoint map */
remote_file_v1_0_s_ifspec, /* handle for interface specification */
binding_vector, /* vector of server binding handles */
NULL, /* no object UUIDs to register */
(unsigned_char_t *)"remote_file server", /* annotation (not required) */
&status
);
CHECK_STATUS(status, "Can't add endpoints to local endpoint map:", ABORT);
puts("Listening for remote procedure calls...");
TRY
rpc_server_listen( /* listen for remote calls */
rpc_c_listen_max_calls_default, /* number of threads */
&status
);
CHECK_STATUS(status, "rpc listen failed:", RESUME);
FINALLY
puts("Removing endpoints from local endpoint map.");
rpc_ep_unregister( /* remove endpoints from local endpoint map */
remote_file_v1_0_s_ifspec, /* handle for interface specificaiton */
binding_vector, /* vector of server binding handles */
NULL, /* no object UUIDs to unregister */
&status
);
CHECK_STATUS(status,"Can't remove endpoints from endpoint map:", RESUME);
rpc_binding_vector_free( /* free set of binding handles */
&binding_vector,
&status
);
CHECK_STATUS(status, "Can't free binding handles and vector\n", ABORT);
ENDTRY
}