RpcServerUnsubscribeForNotification function (rpcasync.h)
The RpcServerUnsubscribeForNotification function unsubscribes the server from RPC notifications.
Syntax
RPC_STATUS RpcServerUnsubscribeForNotification(
[in] RPC_BINDING_HANDLE Binding,
[in] RPC_NOTIFICATIONS Notification,
[out] unsigned long *NotificationsQueued
);
Parameters
[in] Binding
RPC_BINDING_HANDLE structure that contains the binding handle for the current RPC call specified in a previous call to RpcServerSubscribeForNotification. If this function is called on the same thread that RPC has dispatched a call on, this parameter can be set to NULL; otherwise, an explicit binding handle must be passed in this parameter.
[in] Notification
A value from the RPC_NOTIFICATIONS enumeration that specifies the type of notification requested from RPC by the server. Notifications must be unsubscribed individually, multiple values are not supported.
Windows Vista: Currently, only RpcNotificationClientDisconnect and RpcNotificationCallCancel are supported. If any other value is specified for this parameter, the RPC_S_CANNOT_SUPPORT error code is returned.
[out] NotificationsQueued
A required pointer to a value that receives the number of notifications that the RPC runtime queued for the specified RPC call. The pointer must be supplied; it is not optional.
Your code should keep track of the number of notifications that it receives. When you unsubscribe from RPC notifications, you should check if the number of notifications that the RPC runtime queued matches the number of notifications that you received. If the numbers do not match, some notifications could still be incoming on another thread. You should delay cleaning up the notification state until you receive all incoming notifications.
Return value
This function returns RPC_S_OK on success; otherwise, an RPC_S_* error code is returned.
Remarks
RpcServerUnsubscribeForNotification must be called for every RPC binding handle that has also had RpcServerSubscribeForNotification called on it for the associated RPC call. This API must be called before the associated RPC call is completed; otherwise, the results are undefined and could lead to application instability.
Unretrieved notifications may be retrieved after this API returns.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows Vista, Windows XP with SP2 [desktop apps only] |
Minimum supported server | Windows Server 2008, Windows Server 2003 with SP1 [desktop apps only] |
Target Platform | Windows |
Header | rpcasync.h (include Rpc.h) |
Library | Rpcrt4.lib |
DLL | Rpcrt4.dll |