PeerGroupSendData function (p2p.h)

The PeerGroupSendData function sends data to a member over a neighbor or direct connection.

Syntax

NOT_BUILD_WINDOWS_DEPRECATE HRESULT PeerGroupSendData(
  [in] HGROUP     hGroup,
  [in] ULONGLONG  ullConnectionId,
  [in] const GUID *pType,
  [in] ULONG      cbData,
  [in] PVOID      pvData
);

Parameters

[in] hGroup

Handle to the group that contains both members of a connection. This handle is returned by the PeerGroupCreate, PeerGroupOpen, or PeerGroupJoin function. This parameter is required.

[in] ullConnectionId

Unsigned 64-bit integer that contains the ID of the connection that hosts the data transmission. A connection ID is obtained by calling PeerGroupOpenDirectConnection. This parameter is required.

[in] pType

Pointer to a GUID value that uniquely identifies the data being transmitted. This parameter is required.

[in] cbData

Specifies the size of the data in pvData, in bytes. This parameter is required.

[in] pvData

Pointer to the block of data to send. The receiving application is responsible for parsing this data. This parameter is required.

Return value

Returns S_OK if the operation succeeds. Otherwise, the function returns one of the following values.

Return code Description
E_INVALIDARG
One of the parameters is not valid.
PEER_E_CONNECTION_NOT_FOUND
A connection with the ID specified in ullConnectionId cannot be found.
 

Cryptography-specific errors can be returned from the Microsoft RSA Base Provider. These errors are prefixed with CRYPT_* and defined in Winerror.h.

Remarks

To receive data, the receiving peer must have registered for the PEER_GROUP_EVENT_INCOMING_DATA peer event.

Requirements

Requirement Value
Minimum supported client Windows XP with SP2 [desktop apps only],Windows XP with SP1 with the Advanced Networking Pack forWindows XP
Minimum supported server None supported
Target Platform Windows
Header p2p.h
Library P2P.lib
DLL P2P.dll

See also

PeerGroupCloseDirectConnection

PeerGroupCreate

PeerGroupJoin

PeerGroupOpen

PeerGroupOpenDirectConnection