Microsoft DirectX 8.1 (C++)

Terminating a Client/Server Session

To terminate a client/server session, the server calls IDirectPlay8Server::Close. There is no host migration in a client/server session, so this method terminates all connections and closes the session. The clients are notified of the session end by a DPN_MSGID_TERMINATE_SESSION message.

The server will then receive a DPN_MSGID_DESTROY_PLAYER message for each player, including itself. IDirectPlay8Server::Close is synchronous, and will not return until all the DPN_MSGID_DESTROY_PLAYER messages have been processed. Once IDirectPlay8Server::Close has returned, you can safely shut down the server application.