PeerDistServerPublishStream function

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

Syntax


DWORD WINAPI PeerDistServerPublishStream(
  _In_      PEERDIST_INSTANCE_HANDLE hPeerDist,
  DWORD cbContentIdentifier,
  _In_      PBYTE pContentIdentifier[bcount(cbContentIdentifier)],
  ULONGULONG cbContentLength,
  _In_opt_  PCPEERDIST_PUBLICATION_OPTIONS pPublishOptions,
  _In_opt_  HANDLE hCompletionPort,
  _In_opt_  ULONG_PTR ulCompletionKey,
  _Out_     PEERDIST_STREAM_HANDLE phStream
);

Parameters

hPeerDist [in]

A PEERDIST_INSTANCE_HANDLE returned by PeerDistStartup.

cbContentIdentifier

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

pContentIdentifier [in]

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 [in, optional]

Pointer to a PEERDIST_PUBLICATION_OPTIONS structure that specifies content publishing rules.

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 returned through the lpCompletionKey parameter of the GetQueuedCompletionStatus function. This parameter is ignored when hCompletionPort is NULL.

phStream [out]

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 codeDescription
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]

Header

PeerDist.h

Library

PeerDist.lib

DLL

PeerDist.dll

See also

PeerDistServerPublishAddToStream
PeerDistServerOpenContentInformation
PeerDistServerUnpublish
PeerDistServerCancelAsyncOperation
PeerDistServerPublishCompleteStream
PeerDistServerCloseStreamHandle

 

 

Community Additions

ADD
Show:
© 2014 Microsoft