XNetworkingQueryPreferredLocalUdpMultiplayerPortAsync

Gets the preferred local UDP port to use for multiplayer traffic asynchronously.

Syntax

HRESULT XNetworkingQueryPreferredLocalUdpMultiplayerPortAsync(
         XAsyncBlock* asyncBlock
)

Parameters

asyncBlock   _Inout_
Type: XAsyncBlock*

A pointer to the XAsyncBlock that is passed to XAsyncRun.

Return value

Type: HRESULT

HRESULT success or error code.

Remarks

Use the returned preferred local UDP multiplayer port in subsequent socket bind operations. The port is targeted specifically at multiplayer real-time title networking flows and is meaningful for UDP traffic only, not for TCP or HTTP traffic.

To listen for changes in the preferred local UDP multiplayer, call XNetworkingRegisterPreferredLocalUdpMultiplayerPortChanged.

For a description of how the local UDP multiplayer port works, see the Remarks section of the synchronous version of XNetworkingQueryPreferredLocalUdpMultiplayerPort.

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

Preferred local UDP multiplayer port
Windows Sockets (Winsock)
Microsoft Azure PlayFab Party
XNetworking