File:  [WindowsNT SDKs] / mstools / samples / rpc / adder1 / server.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Thu Aug 9 18:20:01 2018 UTC (7 years, 9 months ago) by root
Branches: msft, MAIN
CVS tags: ntsdk-oct-1991, ntsdk-dec-1991, HEAD
Microsoft Windows NT Pre-Release 11-19-1991

/****************************************************************************
                       Microsoft RPC Version 1.0 Alpha
                                October 1991
                               Adder1 Example

    FILE:    adder1\server.c
    USAGE:   server
    PURPOSE: Server side of RPC distributed application adder1
    FUNCTIONS:  main() - registers server as RPC server
    COMMENTS:
    This version of the distributed application that adds two
    short integers features a client that manages its connection
    to the server. It uses the binding handle hRpcAdder1.

****************************************************************************/
#include <stdlib.h>
#include <windows.h>
#include <string.h>
#include <stdio.h>
#include <ctype.h>
#include <rpc.h>       // RPC data structures and APIs
#include "adder1.h"    // interface

void main(void)
{
    RPC_HANDLE Server, Address, Interface;
    RPC_STATUS status;

    adder1_ProtocolStack.TransportType = RPC_TRANSPORT_NAMEPIPE;
    adder1_ProtocolStack.TransportInfo = "\\device\\namedpipe\\adder1";
    adder1_ProtocolStack.TransportInfoLength = \
        strlen(adder1_ProtocolStack.TransportInfo) + 1;

    status = RpcCreateServer( (RPC_EVENT_HANDLERS *)0,
                              &Server);
    if (status) {
        printf("RpcCreateServer: 0x%x\n", status);
        exit(2);
    }

    status = RpcAddAddress(Server,
                           &adder1_ProtocolStack,
                           0,            // address flags
                           &Address,
                           (void *) 0,   // reserved
                           RpcNormalResourceUsage,
                           0L);          // timeout
    if (status) {
        printf("RpcAddAddress: 0x%x", status);
        exit(2);
    }

    status = RpcAddInterface(Server,
                             &adder1_ProtocolStack,
                             &Interface,
                             (void *) 0,  // reserved
                             &adder1_DispatchTable);
    if (status) {
        printf("RpcAddInterface: 0x%x\n", status);
        exit(2);
    }

    printf("adder1 server started.  Waiting for client requests...\n");

    while (1)
        Sleep(5000);

} /* end main() */

/* end adder1\server.c */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.