home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Collection - Online Library - January 1996
/
CKITOS2196.ISO
/
diskette
/
gg244090.dsk
/
unc.dsk
/
CHAPTER.04
/
MATHB_S.C
< prev
next >
Wrap
C/C++ Source or Header
|
1993-10-28
|
2KB
|
55 lines
/******************************************************************************/
/* Module : mathb_s.c */
/* Purpose : Perform the necessary setup for the server manager code */
/* module mathb_m.c. This module registers manager EPV, */
/* selects all protocol sequences available, advertises the server */
/* and listens for RPC requests. */
/******************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <dce/rpc.h>
#include "errchk.h"
#include "mathb.h"
#define MAX_CONC_CALLS_PROTSEQ 4 /* Max concurrent calls per protocol. */
#define MAX_CONC_CALLS_TOTAL 8 /* Max concurrent call total. */
#define ENTRY_NAME "/.:/Servers/MathB" /* Server entry name. */
int main ( int argc, char *argv[] )
{
rpc_binding_vector_t *bv_p;
unsigned32 status;
/* Register interface/epv associations with RPC runtime. */
printf("Registering server interface with RPC runtime...\n");
rpc_server_register_if ( mathb_v1_0_s_ifspec, NULL, NULL, &status );
ERRCHK ( status );
/* Inform RPC runtime to use a supported protocol sequences. */
rpc_server_use_protseq("ncadg_ip_udp",MAX_CONC_CALLS_PROTSEQ, &status );
ERRCHK ( status );
/* Get the binding handle vector from RPC runtime. */
rpc_server_inq_bindings ( &bv_p, &status );
ERRCHK ( status );
/* Register binding information with endpoint map. */
printf("Registering server endpoints with endpoint mapper (RPCD)...\n");
rpc_ep_register ( mathb_v1_0_s_ifspec, bv_p, NULL,
( unsigned_char_t * )"Basic math server, version 1.0",
&status );
ERRCHK ( status );
/* Export binding information to the namespace. */
printf("Exporting server bindings into CDS namespace...\n");
rpc_ns_binding_export ( rpc_c_ns_syntax_dce, ENTRY_NAME,
mathb_v1_0_s_ifspec, bv_p, NULL, &status );
ERRCHK ( status );
/* Listen for service requests. */
printf ( "Server %s listening...\n", ENTRY_NAME );
rpc_server_listen ( MAX_CONC_CALLS_TOTAL, &status );
ERRCHK ( status );
}