|
|
Microsoft Windows NT Pre-Release 11-19-1991
/****************************************************************************
Microsoft RPC Version 1.0 Alpha
October 1991
Hello3 Example
FILE: hello3\server.c
USAGE: server
PURPOSE: Server side of RPC distributed application hello3
FUNCTIONS: main() - registers server as RPC server
COMMENTS:
This version of the distributed application that prints
"hello, world" on the server features a client that
manages its connection to the server. It uses the binding
handle hRpcHello, defined in the file hello3.h.
****************************************************************************/
#include <stdlib.h>
#include <windows.h>
#include <string.h>
#include <stdio.h>
#include <ctype.h>
#include <rpc.h> // RPC data structures and APIs
#include "hello3.h" // interface
void main(void)
{
RPC_HANDLE Server, Address, Interface;
RPC_STATUS status;
/* Select named pipes as the transport type and provide the */
/* name of the named pipe that is used for RPC. */
/* The server specifies the pipe name in the form: */
/* \device\namedpipe\pipename */
/* In this example, the pipename is "hello3" */
hello3_ProtocolStack.TransportType = RPC_TRANSPORT_NAMEPIPE;
hello3_ProtocolStack.TransportInfo = "\\device\\namedpipe\\hello3";
hello3_ProtocolStack.TransportInfoLength =
strlen(hello3_ProtocolStack.TransportInfo) + 1;
status = RpcCreateServer( (RPC_EVENT_HANDLERS *)0,
&Server);
if (status) {
printf("RpcCreateServer: 0x%x", status);
exit(2);
}
status = RpcAddAddress(Server,
&hello3_ProtocolStack,
0, // address flags
&Address,
(void *) 0, // reserved
RpcNormalResourceUsage,
0L); // timeout
if (status) {
printf("RpcAddAddress: %d", status);
exit(2);
}
status = RpcAddInterface(Server,
&hello3_ProtocolStack,
&Interface,
(void *) 0, // reserved
&hello3_DispatchTable);
if (status) {
printf("RpcAddInterface: 0x%x", status);
exit(2);
}
printf("hello3 server started. Waiting for client requests...\n");
while (1)
Sleep(5000);
} /* end main() */
/* end hello3\server.c */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.