Compartir a través de


XblMultiplayerManagerGameSessionSetSynchronizedHost

Sets the host for the game session, using XblMultiplayerSessionWriteMode::SynchronizedUpdate.

Syntax

HRESULT XblMultiplayerManagerGameSessionSetSynchronizedHost(  
         const char* deviceToken,  
         void* context  
)  

Parameters

deviceToken   _In_
Type: char*

The device token of the host.

context   _In_opt_
Type: void*

Optional. The application-defined data to correlate the XblMultiplayerEvent to the initiating call.

Return value

Type: HRESULT

HRESULT return code for this API operation.

Remarks

This function sets the host for the game session. Use this function to ensure atomicity and resolve any conflicts between devices trying to set the host at the same time.
The service may reject the request to set the host if a race condition occurs due to a conflict. If the request is rejected, the service returns HTTP_E_STATUS_PRECOND_FAILED. If a conflict occurs, re-evaluate the need to change the host and, if needed, call this function again to re-submit the request.
The result of this function is delivered as a multiplayer event with an event type set to XblMultiplayerEventType::SynchronizedHostWriteCompleted. You can call XblMultiplayerManagerDoWork to retrieve multiplayer events. Note that host device tokens are generated from a session member's secure device address, so ensure that the secure device address is set for the desired host prior to calling this method.

Requirements

Header: multiplayer_manager_c.h

Library: Microsoft.Xbox.Services.14x.GDK.C.lib

See also

multiplayer_manager_c
XblMultiplayerManagerGameSessionSetSynchronizedProperties
XblMultiplayerEvent
XblMultiplayerManagerLobbySessionSetLocalMemberConnectionAddress