Microsoft DirectX 9.0

IDirectPlay8Server::Close Method

Closes the open connection to a session and uninitializes the IDirectPlay8Server object.


HRESULT Close(      

    const DWORD dwFlags );


[in] The following flag can be specified.
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.


This method must be called on any object successfully initialized with IDirectPlay8Server::Initialize.

This method is a counterpart to IDirectPlay8Server::Host. It closes all active network connections hosted by the server. This method is synchronous, and will not return until the server has processed all DPN_MSGID_DESTROY_PLAYER messages. This feature guarantees that when IDirectPlay8Server::Close returns, you can safely shut down the server application.

Calling IDirectPlay8Server::Close will cancel all outstanding operations, 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 IDirectPlay8Server::SendTo calls to complete before calling IDirectPlay8Server::Close.

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

© 2002 Microsoft Corporation. All rights reserved.