XNetworkingRegisterConnectivityHintChanged

Registers title to changes in device-wide information about the current network connectivity level, data limits, interface type, and network initialization state.

Syntax

HRESULT XNetworkingRegisterConnectivityHintChanged(
         XTaskQueueHandle queue,
         void* context,
         XNetworkingConnectivityHintChangedCallback* callback,
         XTaskQueueRegistrationToken* token
)

Parameters

queue   _In_opt_
Type: XTaskQueueHandle

The queue in which to place the callback when the connectivity hint changes.

context   _In_opt_
Type: void*

Optional context pointer to pass to the callback.

callback   _In_
Type: XNetworkingConnectivityHintChangedCallback*

Function to call when the connectivity hint changes.

token   _Out_
Type: XTaskQueueRegistrationToken*

Token used to identify the callback when unregistering.

Return value

Type: HRESULT

HRESULT success or error code.

Remarks

This function registers a "connectivity hint changed" notification and sends an initial notification callback.

To unregister a callback, use XNetworkingUnregisterConnectivityHintChanged.

The fields in the returned XNetworkingConnectivityHint structure (except the XNetworkingConnectivityHint::networkInitialized field) are hints. They are best-effort guesses by the device about the current state of the network based on a summary of the network traffic on the device. Importantly, these fields do not represent whether there is connectivity to your specific title endpoints. We recommend that, after waiting for network initialization, you use WinSock and/or WinHTTP to try to establish a connection to your endpoint regardless of the state of the XNetworkingConnectivityHint::connectivityLevelHint field. If those APIs subsequently fail, we recommend that you then use the XNetworkingGetConnectivityHint API for additional UI and diagnostic reporting purposes. You should then wait for a change in the network connectivity level before trying again.

For more information about network initialization, see Network Initialization & Connectivity.

This method interrogates the local state within the calling process and returns quickly, so it is safe to call from time-sensitive contexts.

Requirements

Header: XNetworking.h

Library: xgameruntime.lib

Supported platforms: Windows, Xbox One family consoles and Xbox Series consoles

See also

XNetworkingGetConnectivityHint
XNetworkingUnregisterConnectivityHintChanged
XNetworking