PeerDistClientAddData function

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 WINAPI PeerDistClientAddData(
  _In_ PEERDIST_INSTANCE_HANDLE hPeerDist,
  _In_ PEERDIST_CONTENT_HANDLE  hContentHandle,
       DWORD                    cbNumberOfBytes,
  _In_ PBYTE                    pBuffer[bcount(cbNumberOfBytes)],
  _In_ LPOVERLAPPED             lpOverlapped
);

Parameters

hPeerDist [in]

A PEERDIST_INSTANCE_HANDLE returned by PeerDistStartup.

hContentHandle [in]

A PEERDIST_CONTENT_HANDLE returned by PeerDistClientOpenContent.

cbNumberOfBytes

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

pBuffer [in]

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.

lpOverlapped [in]

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

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
PeerDistClientStreamRead
PeerDistClientBlockRead

 

 

Community Additions

ADD
Show: