PartyNetwork::GetDeviceConnectionType

Retrieves the type of connection used by the local device for transmitting messages or chat data to the specified target device in this network.

Syntax

PartyError GetDeviceConnectionType(  
    const PartyDevice* targetDevice,  
    PartyDeviceConnectionType* deviceConnectionType  
)  

Parameters

targetDevice   PartyDevice*

The device whose connection type should be retrieved.

deviceConnectionType   PartyDeviceConnectionType*
output

The output device connection type.

Return value

PartyError

c_partyErrorSuccess if retrieving the connection type succeeded or an error code otherwise. The human-readable form of the error code can be retrieved via PartyManager::GetErrorMessage().

Remarks

Connection types are determined when devices first authenticate an initial user into the network. If this network permitted direct peer-to-peer connectivity via the PartyNetworkConfiguration::directPeerConnectivityOptions field, neither device had excluded such connectivity via the PartyOption::LocalDeviceDirectPeerConnectivityOptionsMask option, and a direct peer connection was successfully established at that time, then this function will report a value of PartyDeviceConnectionType::DirectPeerConnection. Otherwise it will report PartyDeviceConnectionType::RelayServer. The value will not change for as long as the target PartyDevice object remains in this network, even if PartyNetwork::RemoveLocalUser() is called for that initially authenticating user.

If the target device is the local device, PartyDeviceConnectionType::DirectPeerConnection will always be reported regardless of PartyNetworkConfiguration settings or PartyOption::LocalDeviceDirectPeerConnectivityOptionsMask option.

If the target device object is not participating in this network, an error is returned.

If the local device is participating in additional networks with the target device object, you should not assume that calling this same function on those other network objects will report the same value.

Requirements

Header: Party.h

See also

PartyNetwork
PartyDeviceConnectionType
PartyNetworkConfiguration
PartyOption::LocalDeviceDirectPeerConnectivityOptionsMask