PeerDistRegisterForStatusChangeNotification function

The PeerDistRegisterForStatusChangeNotification function requests the Peer Distribution service status change notification.

Syntax


DWORD WINAPI PeerDistRegisterForStatusChangeNotification(
  _In_      PEERDIST_INSTANCE_HANDLE hPeerDist,
  _In_opt_  HANDLE hCompletionPort,
  _In_opt_  ULONG_PTR ulCompletionKey,
  _In_      LPOVERLAPPED lpOverlapped,
  _Out_     PEERDIST_STATUS *pPeerDistStatus
);

Parameters

hPeerDist [in]

A PEERDIST_INSTANCE_HANDLE returned by PeerDistStartup.

hCompletionPort [in, optional]

A handle to the completion port that can be used for retrieving the completion notification of the asynchronous function. To create a completion port, use the CreateIoCompletionPort function. This parameter can be NULL.

ulCompletionKey [in, optional]

Value to be returned through the lpCompletionKey parameter of the GetQueuedCompletionStatus function. This parameter is ignored when hCompletionPort is NULL.

lpOverlapped [in]

Pointer to an OVERLAPPED structure. If the hEvent member of the structure is not NULL, it will be signaled via SetEvent() used in order to signal the notification. This can occur even if the completion port is specified via the hCompletionPort argument.

pPeerDistStatus [out]

A pointer to a PEERDIST_STATUS enumeration that indicates the current status of the Peer Distribution service.

Return value

If the function succeeds, the return value is ERROR_IO_PENDING. Otherwise, the function may return one of the following values:

Return codeDescription
ERROR_INVALID_PARAMETER

One or more parameters are invalid.

ERROR_INVALID_HANDLE

The hPeerDist handle is invalid.

 

Remarks

This function optionally registers a completion port and an OVERLAPPED structure for status change notification. Upon successful completion, the pPeerDistStatus parameter will contain a valid PEERDIST_STATUS value.

Only one active registration for each session is allowed. The caller must register for notification each time after it signals. The notification will be sent only if the current status is changed from the previous notification. After the first call of the PeerDistRegisterForStatusChangeNotification function for the Peer Distribution session, the first notification will trigger only if the status is no longer equal to PEERDIST_STATUS_DISABLED.

A Peer Distribution status change can result in the Peer Distribution service moving to an available, unavailable, or disabled state. If the new status is disabled or unavailable, the content, content information, or stream handles the caller has access to will no longer function. In this case, any API that uses these handles will fail with error PEERDIST_ ERROR_INVALIDATED. The caller must explicitly close the handles by calling the appropriate Peer Distribution API.

Requirements

Minimum supported client

Windows 7 Professional [desktop apps only]

Minimum supported server

Windows Server 2008 R2 [desktop apps only]

Header

PeerDist.h

Library

PeerDist.lib

DLL

PeerDist.dll

See also

PeerDistStartup
PeerDistClientCloseContent
PeerDistServerCloseStreamHandle
PeerDistServerCloseContentInformation

 

 

Community Additions

ADD
Show:
© 2014 Microsoft