IDirectPlay8Peer::Close Method

DirectPlay

 
Microsoft DirectX 9.0 SDK Update (Summer 2003)

IDirectPlay8Peer::Close Method


Closes the open connection to a session and uninitializes the IDirectPlay8Peer object. This method must be called on any object successfully initialized with IDirectPlay8Peer::Initialize.

Syntax

HRESULT Close(      
    const DWORD dwFlags );

Parameters

dwFlags
[in] The following flag can be specified.
DPNCLOSE_IMMEDIATE
Close immediately. Do not wait for outstanding calls to complete.

Return Value

Returns S_OK if successful, or the following error value.

DPNERR_UNINITIALIZEDThe requested object has not been initialized.

Remarks

This method will cancel any operations still outstanding, including guaranteed messages that are in the queue waiting to be sent. Messages that have already been sent as guaranteed will continue to be retried until acknowledgement of their delivery has been received. To make sure all messages are sent, wait for all outstanding IDirectPlay8Peer::SendTo calls to complete before calling IDirectPlay8Peer::Close.

If this method is called by the host player and host migration has been enabled, the host will migrate and the session will continue for other players. If host migration is not enabled, the session will terminate. If the host player wants to terminate the session without host migration, IDirectPlay8Peer::TerminateSession should be called before calling IDirectPlay8Peer::Close. See Host Migration for more information.

To start a new session or connect to another session after calling IDirectPlay8Peer::Close, you must first call IDirectPlay8Peer::Initialize on the IDirectPlay8Peer object before calling IDirectPlay8Peer::Host or IDirectPlay8Peer::Connect.

Calling IDirectPlay8Peer::Close will invalidate any DPN_CAPS, DPN_CAPS_EX, and DPN_SP_CAPS associated with the IDirectPlay8Peer object.

See Also

Leaving a Peer-to-Peer Session, Terminating a Peer-to-Peer Session


© 2003 Microsoft Corporation. All rights reserved.