PeerGraphSendData function (p2p.h)

The PeerGraphSendData function sends data to a neighbor node or a directly connected node.

Syntax

NOT_BUILD_WINDOWS_DEPRECATE HRESULT PeerGraphSendData(
  [in] HGRAPH     hGraph,
  [in] ULONGLONG  ullConnectionId,
  [in] const GUID *pType,
  [in] ULONG      cbData,
  [in] PVOID      pvData
);

Parameters

[in] hGraph

Handle to the peer graph.

[in] ullConnectionId

Specifies the unique ID of the connection to send data on.

[in] pType

Specifies an application-defined data type to send. This parameter cannot be NULL.

[in] cbData

Specifies the number of bytes pointed to by pvData.

[in] pvData

Pointer to the data to send.

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
No connection with the given ID exists.
PEER_E_INVALID_GRAPH
The handle to the peer graph is invalid.
PEER_E_NOT_INITIALIZED
The graph must be initialized with a call to PeerGraphStartup before using this function.

Remarks

The PeerGraphSendData function returns as soon as data has been sent to the network layer; the peer graphing layer does not wait for an acknowledgment from the other side of the connection.

Note  In order to be able to receive data with a direct connection, an application must register for a peer event of type PEER_GRAPH_EVENT_INCOMING_DATA. See PeerGraphRegisterEvent.
 

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 P2PGraph.lib
DLL P2PGraph.dll

See also

PeerGraphEnumConnections

PeerGraphOpenDirectConnection

PeerGraphRegisterEvent