XNetworkingPreferredLocalUdpMultiplayerPortChangedCallback

Gets called when the preferred local multiplayer port is changed.

Syntax

void XNetworkingPreferredLocalUdpMultiplayerPortChangedCallback(
         void* context,
         uint16_t preferredLocalUdpMultiplayerPort
)

Parameters

context   _In_opt_
Type: void*

An optional context pointer that was passed to the XNetworkingRegisterPreferredLocalUdpMultiplayerPortChanged function.

preferredLocalUdpMultiplayerPort   _In_
Type: uint16_t

Pointer to the preferred local User Datagram Protocol (UDP) multiplayer port in host order.

Return value

Type: void

Remarks

XNetworkingPreferredLocalUdpMultiplayerPortChangedCallback gets called when the title listens for changes in the preferred local UDP multiplayer port. All attempts are made to ensure the preferred local UDP multiplayer port does not change while the title is running. However, there are unavoidable cases where the port will change due to the user's external network conditions changing and invalidating any existing socket flows. The port is especially likely to change when the network connectivity level changes, or as part of a title's suspend/resume cycle.

For more information, see the "Changes in the preferred local UDP multiplayer port" section of Preferred local User Datagram Protocol (UDP) multiplayer port networking APIs.

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

XNetworkingRegisterPreferredLocalUdpMultiplayerPortChanged
XNetworking