Click to open or copy the files for the Cluuid sample.
This sample demonstrates how to supply multiple implementations of the remote procedure specified in the interface. It also demonstrates how the client selects among the implementations by providing a client object uuid.
The server calls RpcObjectSetType to associate a client object uuid with the object uuid in the Object Registry Table. The server initializes a manager entry point vector (manager epv) and then calls RpcRegisterIf to associate the interface uuid and the object uuid with the manager epv in the Interface Registry Table.
When the client makes a remote procedure call, the client object uuid is mapped to the object uuid in the Object Registry Table. The resulting object uuid and the interface uuid are mapped to a manager entry point vector in the Interface Registry Table.
By default, in this example, the server registers two implementations of the "Hello, World" function HelloProc and HelloProc2. The HelloProc2 implementation is associated with the object uuid "11111111-1111-1111-1111-111111111111". When the client makes a procedure call with a null uuid, the client's request is mapped to the original HelloProc. When the client makes a procedure call with the client object uuid "11111111-1111-1111-1111-11111111111", the client's request is mapped to HelloProc2 (which prints the string in reverse).
Main Files
The directory Samples\Rpc\Cluuid contains the following files for building the sample distributed application Cluuid:
File | Description |
Cluuid.idl | Interface definition language file |
Cluuid.acf | Attribute configuration file |
Cluuidc.c | Client main program |
Cluuids.c | Server main program |
Cluuidp.c | Remote procedures |
Makefile | Nmake file to build for Windows NT or Windows 95 |
Makefile.dos | Nmake file to build for MS-DOS |
This sample uses the following keywords:
atoi; cluuid_helloproc; cluuid_shutdown; defined; exit; fprintf; free; helloproc; helloproc2; malloc; midl_user_allocate; midl_user_free; ndrclientinitializenew; ndrconformantstringbuffersize; ndrconformantstringmarshall; ndrconformantstringunmarshall; ndrconvert; ndrfcshort; ndrfreebuffer; ndrgetbuffer; ndrsendreceive; ndrserverinitializenew; printf; rpcbindingfree; rpcbindingfromstringbinding; rpcexcept; rpcexceptioncode; rpcmgmtstopserverlistening; rpcmgmtwaitserverlisten; rpcobjectsettype; rpcserverlisten; rpcserverregisterif; rpcserverunregisterif; rpcserveruseprotseqep; rpcstringbindingcompose; rpcstringfree; shutdown; strrev; tolower; usage; uuidfromstring