> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# PartyNetworkConfiguration

> Network configuration data.

Network configuration data.

## Syntax

```cpp theme={null}
struct PartyNetworkConfiguration {  
    uint32_t maxUserCount;  
    uint32_t maxDeviceCount;  
    uint32_t maxUsersPerDeviceCount;  
    uint32_t maxDevicesPerUserCount;  
    uint32_t maxEndpointsPerDeviceCount;  
    PartyDirectPeerConnectivityOptions directPeerConnectivityOptions;  
}  
```

### Members

**`maxUserCount`**   uint32\_t

The maximum number of unique users allowed in the network.

This value must be greater than 0. <br /><br /> If a client would violate this limit by calling [PartyNetwork::AuthenticateLocalUser()](/services/playfab/multiplayer/networking/reference/classes/PartyNetwork/methods/partynetwork_authenticatelocaluser), the operation will fail asynchronously and [PartyAuthenticateLocalUserCompletedStateChange::result](/services/playfab/multiplayer/networking/reference/structs/partyauthenticatelocalusercompletedstatechange) will be set to [PartyStateChangeResult::NetworkLimitReached](/services/playfab/multiplayer/networking/reference/enums/partystatechangeresult).

**`maxDeviceCount`**   uint32\_t

The maximum number of devices allowed to connect to the network.

PlayFab Party networks can scale to support anywhere between 2 and 128 devices. The service will choose a network relay configuration optimized for your scenario, so it's important to configure the `maxDeviceCount` in `PartyNetworkConfiguration` to match the max expected number of devices in your network. <br /><br /> If a client would violate this limit by calling [PartyManager::ConnectToNetwork()](/services/playfab/multiplayer/networking/reference/classes/PartyManager/methods/partymanager_connecttonetwork), the operation will fail asynchronously and [PartyConnectToNetworkCompletedStateChange::result](/services/playfab/multiplayer/networking/reference/structs/partyconnecttonetworkcompletedstatechange) will be set to [PartyStateChangeResult::NetworkLimitReached](/services/playfab/multiplayer/networking/reference/enums/partystatechangeresult).

**`maxUsersPerDeviceCount`**   uint32\_t

The maximum number of users allowed per device.

This value must be between 1 and `c_maxLocalUsersPerDeviceCount` inclusive. <br /><br /> If a client would violate this limit by calling [PartyNetwork::AuthenticateLocalUser()](/services/playfab/multiplayer/networking/reference/classes/PartyNetwork/methods/partynetwork_authenticatelocaluser), the operation will fail asynchronously and [PartyAuthenticateLocalUserCompletedStateChange::result](/services/playfab/multiplayer/networking/reference/structs/partyauthenticatelocalusercompletedstatechange) will be set to [PartyStateChangeResult::NetworkLimitReached](/services/playfab/multiplayer/networking/reference/enums/partystatechangeresult).

**`maxDevicesPerUserCount`**   uint32\_t

The maximum number of devices allowed per user.

This value must be greater than 0. <br /><br /> If a client would violate this limit by calling [PartyNetwork::AuthenticateLocalUser()](/services/playfab/multiplayer/networking/reference/classes/PartyNetwork/methods/partynetwork_authenticatelocaluser), the operation will fail asynchronously and [PartyAuthenticateLocalUserCompletedStateChange::result](/services/playfab/multiplayer/networking/reference/structs/partyauthenticatelocalusercompletedstatechange) will be set to [PartyStateChangeResult::NetworkLimitReached](/services/playfab/multiplayer/networking/reference/enums/partystatechangeresult).

**`maxEndpointsPerDeviceCount`**   uint32\_t

The maximum number of endpoints allowed per device.

This value must be between 0 and `c_maxNetworkConfigurationMaxEndpointsPerDeviceCount` inclusive. <br /><br /> If a client would violate this limit by calling [PartyNetwork::CreateEndpoint()](/services/playfab/multiplayer/networking/reference/classes/PartyNetwork/methods/partynetwork_createendpoint) after the network configuration was made available, the call to PartyNetwork::CreateEndpoint() will fail synchronously. If the client had already queued a violating number of endpoint creations when the network configuration became available, the client will be kicked from the network and a [PartyNetworkDestroyedStateChange](/services/playfab/multiplayer/networking/reference/structs/partynetworkdestroyedstatechange) will be generated.

**`directPeerConnectivityOptions`**   [PartyDirectPeerConnectivityOptions](/services/playfab/multiplayer/networking/reference/enums/partydirectpeerconnectivityoptions)

Whether and how to support direct peer-to-peer connection attempts among devices in the network.

As part of successfully authenticating an initial user into a network, a device may attempt to establish direct peer-to-peer connections with other devices already participating in the network when permitted by these flags. For attempts that are successful, endpoint messages and chat data between the devices will be transmitted using those direct connections. For attempts that fail due to environmental incompatibilities between the devices, all communication between those devices will be transmitted via transparent cloud relay servers instead. If the devices aren't permitted to attempt direct peer connections by these flags, then they never exchange IP address information and will always transmit endpoint messages and chat data via transparent cloud relay servers. <br /><br /> You can determine whether the local device actually established a direct peer-to-peer connection to a specific remote device by calling [PartyNetwork::GetDeviceConnectionType()](/services/playfab/multiplayer/networking/reference/classes/PartyNetwork/methods/partynetwork_getdeviceconnectiontype).   <br /><br /> Successful direct peer connectivity may provide lower latency between some devices, though attempting to establish it also requires users to disclose their devices' IP addresses to others, which may be a concern for privacy or for enabling malicious users to potentially attack peers' devices and Internet connections outside of the title. It also may not be permitted on certain platforms for policy reasons. Be sure to use the appropriate flags for your performance and security goals.   <br /><br /> Besides the specific network's value configured here, the flags may optionally be further constrained by a device for all networks into which it authenticates by using [PartyManager::SetOption()](/services/playfab/multiplayer/networking/reference/classes/PartyManager/methods/partymanager_setoption) to set [PartyOption::LocalDeviceDirectPeerConnectivityOptionsMask](/services/playfab/multiplayer/networking/reference/enums/partyoption). All flags are evaluated using a bitwise AND operation. That is, a particular flag is actually only in effect for a given network's pair of devices if it's enabled in three places: this field for the network, and *both* devices' respective local mask options. Even if this field permits direct peer connectivity of the relevant form, either device can unilaterally opt out of the IP address disclosure and direct connection attempts between them by not enabling the flag in its local device mask option. The [PartyOption::LocalDeviceDirectPeerConnectivityOptionsMask](/services/playfab/multiplayer/networking/reference/enums/partyoption) value defaults to permitting all direct peer connections enabled by networks, so you only need to configure it if you have device-specific requirements to prevent some or all direct peer connectivity involving it.   <br /><br /> To avoid excessive resource consumption, the Party library will also internally prevent any given device from attempting to establish more than a configured maximum number of direct peer connections across all networks in which it's currently participating, even if permitted by these flags. This doesn't affect the device's ability to participate in large or multiple networks with additional remote devices. Communication with additional devices will simply be transmitted via transparent cloud relay servers. To modify that maximum number of direct peer connections, use [PartyManager::SetOption()](/services/playfab/multiplayer/networking/reference/classes/PartyManager/methods/partymanager_setoption) to set [PartyOption::LocalDeviceMaxDirectPeerConnections](/services/playfab/multiplayer/networking/reference/enums/partyoption).   <br /><br /> It's recommended that you don't actively enforce the availability of a direct peer-to-peer connection for any given pair of devices (i.e., don't call [PartyNetwork::LeaveNetwork()](/services/playfab/multiplayer/networking/reference/classes/PartyNetwork/methods/partynetwork_leavenetwork) if [PartyNetwork::GetDeviceConnectionType()](/services/playfab/multiplayer/networking/reference/classes/PartyNetwork/methods/partynetwork_getdeviceconnectiontype) reports a value other than [PartyDeviceConnectionType::DirectPeerConnection](/services/playfab/multiplayer/networking/reference/enums/partydeviceconnectiontype)) since the specific underlying transmission method in use doesn't alter the overall logical ability to communicate. If your game design has stringent requirements for maximum message latency that encourage direct peer connectivity, it's better to take action on the current concrete observations of that latency as reported by the [PartyEndpointStatistic::AverageDeviceRoundTripLatencyInMilliseconds](/services/playfab/multiplayer/networking/reference/enums/partyendpointstatistic) statistic rather than make abstract assumptions based on transmission mechanism. Otherwise you might continually hinder users trying to play with the same set of friends who always need to use nearby transparent cloud relay servers due to environmental factors beyond their control.

## Requirements

**Header:** Party.h

## See also

[Party members](/services/playfab/multiplayer/networking/reference/party_members)\
[PartyNetwork::AuthenticateLocalUser](/services/playfab/multiplayer/networking/reference/classes/PartyNetwork/methods/partynetwork_authenticatelocaluser)\
[PartyAuthenticateLocalUserCompletedStateChange](/services/playfab/multiplayer/networking/reference/structs/partyauthenticatelocalusercompletedstatechange)\
[PartyManager::ConnectToNetwork](/services/playfab/multiplayer/networking/reference/classes/PartyManager/methods/partymanager_connecttonetwork)\
[PartyConnectToNetworkCompletedStateChange](/services/playfab/multiplayer/networking/reference/structs/partyconnecttonetworkcompletedstatechange)\
[PartyNetwork::CreateEndpoint](/services/playfab/multiplayer/networking/reference/classes/PartyNetwork/methods/partynetwork_createendpoint)\
[PartyNetworkDestroyedStateChange](/services/playfab/multiplayer/networking/reference/structs/partynetworkdestroyedstatechange)\
[PartyStateChangeResult](/services/playfab/multiplayer/networking/reference/enums/partystatechangeresult)\
[PartyDirectPeerConnectivityOptions](/services/playfab/multiplayer/networking/reference/enums/partydirectpeerconnectivityoptions)


## Related topics

- [PartyNetworkConfigurationMadeAvailableStateChange](/services/playfab/multiplayer/networking/reference/structs/partynetworkconfigurationmadeavailablestatechange.md)
- [PartyNetwork::GetNetworkConfiguration](/services/playfab/multiplayer/networking/reference/classes/PartyNetwork/methods/partynetwork_getnetworkconfiguration.md)
- [PartyOption](/services/playfab/multiplayer/networking/reference/enums/partyoption.md)
- [PartyNetwork::GetDeviceConnectionType](/services/playfab/multiplayer/networking/reference/classes/PartyNetwork/methods/partynetwork_getdeviceconnectiontype.md)
- [PlayFab Party networks and network discovery flows](/services/playfab/multiplayer/networking/concepts-discovery.md)
