PeerDistServerPublishStream function (peerdist.h)
The PeerDistServerPublishStream function initializes a new stream to be published to the Peer Distribution service.
Syntax
DWORD PeerDistServerPublishStream(
[in] PEERDIST_INSTANCE_HANDLE hPeerDist,
DWORD cbContentIdentifier,
[in] PBYTE pContentIdentifier,
ULONGLONG cbContentLength,
[in, optional] PCPEERDIST_PUBLICATION_OPTIONS pPublishOptions,
[in, optional] HANDLE hCompletionPort,
[in, optional] ULONG_PTR ulCompletionKey,
[out] PPEERDIST_STREAM_HANDLE phStream
);
Parameters
[in] hPeerDist
A PEERDIST_INSTANCE_HANDLE returned by PeerDistStartup.
cbContentIdentifier
The length, in bytes, of the buffer that contains content identifier data.
[in] pContentIdentifier
A pointer to an array that contains a content identifier data.
cbContentLength
The length, in bytes, of the content to be published. This value can be 0 if the content length is not yet known. If a non-zero argument is provided then it must match to the total data length added by PeerDistServerPublishAddToStream function calls.
[in, optional] pPublishOptions
Pointer to a PEERDIST_PUBLICATION_OPTIONS structure that specifies content publishing rules.
[in, optional] hCompletionPort
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.
[in, optional] ulCompletionKey
Value returned through the lpCompletionKey parameter of the GetQueuedCompletionStatus function. This parameter is ignored when hCompletionPort is NULL.
[out] phStream
A pointer that receives a handle to the stream that is used to publish data into the Peer Distribution service.
Return value
If the function succeeds, the return value is ERROR_SUCCESS. Otherwise, the function may return one of the following values:
Return code | Description |
---|---|
|
One or more parameters are invalid. |
|
The specified hPeerDist is invalid. |
|
The content identifier used for publication is already published. |
|
The feature is disabled by Group Policy. |
|
The service is unavailable. |
Remarks
A content identifier is a user defined label for the content being published. This content identifier is used for PeerDistServerOpenContentInformation, PeerDistServerUnpublish, and PeerDistServerCancelAsyncOperation calls.
The handle received by phStream can be used in PeerDistServerPublishAddToStream and PeerDistServerPublishCompleteStream to publish data into the Peer Distribution service. This handle should be closed by PeerDistServerCloseStreamHandle.
A publication is accessible only to the User Account that originally published the content. If a different user calls PeerDistServerPublishStream with the same content identifier, a separate publication will be created under the context of that user.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows 7 Professional [desktop apps only] |
Minimum supported server | Windows Server 2008 R2 [desktop apps only] |
Target Platform | Windows |
Header | peerdist.h |
Library | PeerDist.lib |
DLL | PeerDist.dll |
See also
PeerDistServerCancelAsyncOperation
PeerDistServerCloseStreamHandle
PeerDistServerOpenContentInformation
PeerDistServerPublishAddToStream