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