|
|
1.1 ! root 1: /**************************************************************************** ! 2: Microsoft RPC Version 1.0 Alpha ! 3: October 1991 ! 4: Adder1 Example ! 5: ! 6: FILE: adder1\server.c ! 7: USAGE: server ! 8: PURPOSE: Server side of RPC distributed application adder1 ! 9: FUNCTIONS: main() - registers server as RPC server ! 10: COMMENTS: ! 11: This version of the distributed application that adds two ! 12: short integers features a client that manages its connection ! 13: to the server. It uses the binding handle hRpcAdder1. ! 14: ! 15: ****************************************************************************/ ! 16: #include <stdlib.h> ! 17: #include <windows.h> ! 18: #include <string.h> ! 19: #include <stdio.h> ! 20: #include <ctype.h> ! 21: #include <rpc.h> // RPC data structures and APIs ! 22: #include "adder1.h" // interface ! 23: ! 24: void main(void) ! 25: { ! 26: RPC_HANDLE Server, Address, Interface; ! 27: RPC_STATUS status; ! 28: ! 29: adder1_ProtocolStack.TransportType = RPC_TRANSPORT_NAMEPIPE; ! 30: adder1_ProtocolStack.TransportInfo = "\\device\\namedpipe\\adder1"; ! 31: adder1_ProtocolStack.TransportInfoLength = \ ! 32: strlen(adder1_ProtocolStack.TransportInfo) + 1; ! 33: ! 34: status = RpcCreateServer( (RPC_EVENT_HANDLERS *)0, ! 35: &Server); ! 36: if (status) { ! 37: printf("RpcCreateServer: 0x%x\n", status); ! 38: exit(2); ! 39: } ! 40: ! 41: status = RpcAddAddress(Server, ! 42: &adder1_ProtocolStack, ! 43: 0, // address flags ! 44: &Address, ! 45: (void *) 0, // reserved ! 46: RpcNormalResourceUsage, ! 47: 0L); // timeout ! 48: if (status) { ! 49: printf("RpcAddAddress: 0x%x", status); ! 50: exit(2); ! 51: } ! 52: ! 53: status = RpcAddInterface(Server, ! 54: &adder1_ProtocolStack, ! 55: &Interface, ! 56: (void *) 0, // reserved ! 57: &adder1_DispatchTable); ! 58: if (status) { ! 59: printf("RpcAddInterface: 0x%x\n", status); ! 60: exit(2); ! 61: } ! 62: ! 63: printf("adder1 server started. Waiting for client requests...\n"); ! 64: ! 65: while (1) ! 66: Sleep(5000); ! 67: ! 68: } /* end main() */ ! 69: ! 70: /* end adder1\server.c */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.