The RpcServerListen function tells the RPC run-time library to listen for remote procedure calls. This function will not affect auto-listen interfaces. See RpcServerRegisterIfEx for more details.
This function is supported by both server platforms — Windows NT and Windows 95.
#include <rpc.h>
RPC_STATUS RPC_ENTRY RpcServerListen(
unsigned int MinimumCallThreads,
unsigned int MaxCalls,
unsigned int DontWait
);
Use RPC_C_LISTEN_MAX_CALLS_DEFAULT to specify the default value.
Note The Microsoft RPC implementation of RpcServerListen includes two new, additional parameters that do not appear in the DCE specification: DontWait and MinimumCallThreads.
A server calls the RpcServerListen routine when the server is ready to process remote procedure calls. RPC allows a server to simultaneously process multiple calls. The MaxCalls argument recommends the maximum number of concurrent remote procedure calls the server should execute.
The MaxCalls value should be equal to or greater than the largest MaxCalls value specified to the routines RpcServerUseProtseq, RpcServerUseProtseqEp, RpcServerUseProtseqIf, RpcServerUseAllProtseqs, and RpcServerUseAllProtseqsIf.
A server application is responsible for concurrency control between the server manager routines because each routine executes in a separate thread.
When the DontWait parameter has a value of zero, the RPC run-time library continues listening for remote procedure calls (that is, the routine does not return to the server application) until one of the following events occurs:
Once it receives a stop-listening request, the RPC run-time library stops accepting new remote procedure calls for all registered interfaces. Executing calls are allowed to complete, including callbacks.
After all calls complete, the RpcServerListen routine returns to the caller.
When the DontWait parameter has a non-zero value, RpcServerListen returns to the server immediately after processing all the instructions associated with the function. You can use the RpcMgmtWaitServerListen routine to perform the "wait" operation usually associated with RpcServerListen.
Value | Meaning |
---|---|
RPC_S_OK | Success |
RPC_S_ALREADY_LISTENING | Server already listening |
RPC_S_NO_PROTSEQS_REGISTERED | No protocol sequences registered |
RPC_S_MAX_CALLS_TOO_SMALL | Maximum calls value too small |
Windows NT: Yes
Windows CE: Unsupported.
Header: Declared in rpcdce.h.
Import Library: Link with rpcrt4.lib.
RpcMgmtStopServerListening, RpcMgmtWaitServerListen, RpcServerRegisterIf, RpcServerRegisterIfEx, RpcServerUseAllProtseqs, RpcServerUseAllProtseqsIf, RpcServerUseProtseq, RpcServerUseProtseqEp, RpcServerUseProtseqIf