DCE Application Programming Guide
Sample Application Listings
HP NonStop DCE Application Programming Guide—429551-003
A-5
The Server File
Figure A-4. The Server File in a Straight Port (page 1 of 2)
/* infpls_s.c */
/*
* (c) Copyright 1993 Harold W. Lockhart and Frederic M. Oldfield
* ALL RIGHTS RESERVED
*
* Permission is hereby granted to use, copy, modify and freely
* distribute this software for any purpose without fee, provided
* that the above copyright notice and this permission notice are
* retained in it.
*
* The authors make no representations about the suitability of
* this software for any purpose. It is provided "as is" without
* express or implied warranty. The authors assume no liability,
* direct or consequential, resulting from its use.
*/
#include <stdio.h>
#include <sys/utsname.h>
#if defined (_XOPEN_SOURCE)
#include <errno.h> /* (a) */
#else
#include <sys/errno.h>
#endif
#include <dce/rpc.h>
#include <dce/pthread_exc.h>
#include "infpls.h"
#include "errmac.h"
/***** Server Control *****/
main( int argc, char *argv[] )
{
unsigned32 max_threads;
error_status_t status;
rpc_binding_vector_t *bindings;
idl_char annotation[]="Information Please Program";
if (argc > 2 )
{
fprintf(stderr, "Usage: %s maximum_threads\n", argv[0] );
exit(1);
}
if (argc < 2 )
{
max_threads = rpc_c_listen_max_calls_default;
}
else
max_threads = atol(argv[1]);
rpc_server_register_if( infpls_v1_0_s_ifspec, /* (1) */
NULL,
NULL,
&status);
ERR_CHK(status,"Could not register interface");
rpc_server_use_protseq( (idl_char *) "ncadg_ip_udp", /* (2) */
max_threads,
&status);
ERR_CHK(status,"Could not use UDP protocol");