PeerDistClientAddData function (peerdist.h)

The PeerDistClientAddData function is used to supply content to the local cache. Typically this is done when data could not be found on the local network as indicated when either PeerDistClientBlockRead or PeerDistClientStreamRead complete with ERROR_TIMEOUT or PEERDIST_ERROR_MISSING_DATA.

Syntax

DWORD PeerDistClientAddData(
  [in] PEERDIST_INSTANCE_HANDLE hPeerDist,
  [in] PEERDIST_CONTENT_HANDLE  hContentHandle,
       DWORD                    cbNumberOfBytes,
  [in] PBYTE                    pBuffer,
  [in] LPOVERLAPPED             lpOverlapped
);

Parameters

[in] hPeerDist

A PEERDIST_INSTANCE_HANDLE returned by PeerDistStartup.

[in] hContentHandle

A PEERDIST_CONTENT_HANDLE returned by PeerDistClientOpenContent.

cbNumberOfBytes

The number of bytes to be added to the local cache.

[in] pBuffer

Pointer to the buffer that contains the data to be added to the local cache. This buffer must remain valid for the duration of the add operation. The caller must not use this buffer until the add operation is completed.

[in] lpOverlapped

Pointer to an OVERLAPPED structure. The byte offset from the beginning of content, at which this data is being added, is specified by setting the Offset and OffsetHigh members of the OVERLAPPED structure. The OffsetHigh member MUST be set to the higher 32 bits of the byte offset and the Offset member MUST be set to the lower 32 bits of the byte offset.

Return value

If the function succeeds, the return value is ERROR_IO_PENDING. 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 hPeerDist or hContent handle is invalid.
ERROR_ACCESS_DISABLED_BY_POLICY
The feature is disabled by Group Policy.
PEERDIST_ERROR_SERVICE_UNAVAILABLE
The service is unavailable.

Remarks

The data that has been added with this function and passed verification is available to other peers or hosted cache for download. The Peer Distribution service stores this data in its local cache.

If the API completes with PEERDIST_ERROR_OUT_OF_BOUNDS, this indicates that the offset specified in the overlapped structure is beyond the end of the content.

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

PeerDistClientBlockRead

PeerDistClientStreamRead

PeerDistStartup