Annotation of mstools/samples/rpc/hello1/server.c, revision 1.1

1.1     ! root        1: /****************************************************************************
        !             2:                        Microsoft RPC Version 1.0 Alpha
        !             3:                                 October 1991
        !             4:                                Hello1 Example
        !             5:     FILE:       hello1\server.c
        !             6:     USAGE:      server
        !             7:     PURPOSE:    Server side of RPC distributed application hello1
        !             8:     FUNCTIONS:  main() - registers server as RPC server
        !             9:     COMMENTS:
        !            10:     This version of the distributed application that prints
        !            11:     "hello, world" on the server features automatic binding.
        !            12:     The client application makes the remote call as if it
        !            13:     were a local call.
        !            14: ****************************************************************************/
        !            15: #include <stdlib.h>
        !            16: #include <windows.h>
        !            17: #include <string.h>
        !            18: #include <stdio.h>
        !            19: #include <ctype.h>
        !            20: 
        !            21: #include <rpc.h>       // RPC data structures and APIs
        !            22: #include "hello1.h"    // remote data and functions
        !            23: 
        !            24: void main(void)
        !            25: {
        !            26:     RPC_HANDLE Server, Address, Interface;
        !            27:     RPC_STATUS status;
        !            28: 
        !            29:     hello1_ProtocolStack.TransportType = RPC_TRANSPORT_NAMEPIPE;
        !            30:     hello1_ProtocolStack.TransportInfo = "\\device\\namedpipe\\hello1";
        !            31:     hello1_ProtocolStack.TransportInfoLength =
        !            32:         strlen(hello1_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:                            &hello1_ProtocolStack,
        !            43:                            0,            // address flags
        !            44:                            &Address,
        !            45:                            (void *) 0,   // reserved
        !            46:                            RpcNormalResourceUsage,
        !            47:                            0L);          // timeout
        !            48:     if (status) {
        !            49:         printf("RpcAddAddress: 0x%x\n", status);
        !            50:         exit(2);
        !            51:     }
        !            52: 
        !            53:     status = RpcAddInterface(Server,
        !            54:                              &hello1_ProtocolStack,
        !            55:                              &Interface,
        !            56:                              (void *) 0,  // reserved
        !            57:                              &hello1_DispatchTable);
        !            58:     if (status) {
        !            59:         printf("RpcAddInterface: 0x%x\n", status);
        !            60:         exit(2);
        !            61:     }
        !            62:     printf("This application requires the locator service.\n");
        !            63:     printf("The locator service is not provided with RPC V1.0 Alpha.\n");
        !            64:     exit(0);
        !            65: 
        !            66:     status = RpcExport(Server,
        !            67:                        RpcScopeLocal,
        !            68:                        &hello1_ProtocolStack);
        !            69:     if (status) {
        !            70:         printf("RpcExport: 0x%x\n", status);
        !            71:         exit(2);
        !            72:     }
        !            73: 
        !            74:     printf("Hello1 server started.  Waiting for client requests...\n");
        !            75: 
        !            76:     while (1)
        !            77:         Sleep(5000);
        !            78: 
        !            79: } /* end hello1\server.c */

unix.superglobalmegacorp.com

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