PeerGroupOpenDirectConnection function

The PeerGroupOpenDirectConnection function establishes a direct connection with another peer in a peer group.

Syntax


HRESULT WINAPI PeerGroupOpenDirectConnection(
  _In_   HGROUP hGroup,
  _In_   PCWSTR pwzIdentity,
  _In_   PPEER_ADDRESS pAddress,
  _Out_  ULONGLONG *pullConnectionId
);

Parameters

hGroup [in]

Handle to the peer group that hosts the direct connection. This handle is returned by the PeerGroupCreate, PeerGroupOpen, or PeerGroupJoin function. This parameter is required.

pwzIdentity [in]

Pointer to a Unicode string that contains the identity a peer connects to. This parameter is required.

pAddress [in]

Pointer to a PEER_ADDRESS structure that contains the IPv6 address the peer connects to. This parameter is required.

pullConnectionId [out]

Unsigned 64-bit integer that identifies the direct connection. This ID value cannot be assumed as valid until the PEER_GROUP_EVENT_DIRECT_CONNECTION event is raised and indicates that the connection has been accepted by the other peer. This parameter is required.

Return value

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

Return codeDescription
E_INVALIDARG

One of the parameters is not valid.

E_OUTOFMEMORY

There is not enough memory available to complete the operation.

PEER_E_CONNECT_SELF

The connection failed because it was a loopback, that is, the connection is between a peer and itself.

PEER_E_NO_KEY_ACCESS

Access to the peer identity or peer group keys is denied. This is typically caused by an incorrect access control list (ACL) for the folder that contains the user or computer keys. This can happen when the ACL has been reset manually.

 

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

Remarks

Every direct connection opened with this function must be closed with PeerGroupCloseDirectConnection when the exchange has finished. If the peer refuses a connection or if the connection fails, S_OK is returned. However, a PEER_GROUP_EVENT_DIRECT_CONNECTION event is generated, and the corresponding PEER_GROUP_EVENT DATA structure has the status member of its component PEER_EVENT_CONNECTION_CHANGE_DATA structure set to PEER_CONNECTION_FAILED.

Requirements

Minimum supported client

Windows XP with SP2 [desktop apps only]

Minimum supported server

None supported

Version

Windows XP with SP1 with the Advanced Networking Pack forWindows XP

Header

P2P.h

Library

P2P.lib

DLL

P2P.dll

See also

PEER_ADDRESS
PEER_EVENT_CONNECTION_CHANGE_DATA
PEER_GROUP_EVENT DATA
PEER_GROUP_EVENT_DIRECT_CONNECTION
PeerGroupCloseDirectConnection
PeerGroupCreate
PeerGroupJoin
PeerGroupOpen
PeerGroupSendData

 

 

Community Additions

ADD
Show:
© 2014 Microsoft