PeerDistServerPublishStream function

The PeerDistServerPublishStream function initializes a new stream to be published to the Peer Distribution service.

Syntax

DWORD PeerDistServerPublishStream(
  PEERDIST_INSTANCE_HANDLE       hPeerDist,
  DWORD                          cbContentIdentifier,
  PBYTE                          pContentIdentifier,
  ULONGLONG                      cbContentLength,
  PCPEERDIST_PUBLICATION_OPTIONS pPublishOptions,
  HANDLE                         hCompletionPort,
  ULONG_PTR                      ulCompletionKey,
  PPEERDIST_STREAM_HANDLE        phStream
);

Parameters

hPeerDist

A PEERDIST_INSTANCE_HANDLE returned by PeerDistStartup.

cbContentIdentifier

The length, in bytes, of the buffer that contains content identifier data.

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.

pPublishOptions

Pointer to a PEERDIST_PUBLICATION_OPTIONS structure that specifies content publishing rules.

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.

ulCompletionKey

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

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
ERROR_INVALID_PARAMETER
One or more parameters are invalid.
ERROR_INVALID_HANDLE
The specified hPeerDist is invalid.
PEERDIST_ERROR_ALREADY_EXISTS
The content identifier used for publication is already published.
ERROR_ACCESS_DISABLED_BY_POLICY
The feature is disabled by Group Policy.
PEERDIST_ERROR_SERVICE_UNAVAILABLE
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

   
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

PeerDistServerPublishCompleteStream

PeerDistServerUnpublish