Microsoft DirectX 9.0 SDK Update (Summer 2003) |
Microsoft® DirectPlay® generates the DPN_MSGID_TERMINATE_SESSION message when a session is terminated by the host.
The DPNMSG_TERMINATE_SESSION structure contains information for the DPN_MSGID_TERMINATE_SESSION system message.
Syntax
typedef struct _DPNMSG_TERMINATE_SESSION { DWORD dwSize; HRESULT hResultCode; PVOID pvTerminateData; DWORD dwTerminateDataSize; } DPNMSG_TERMINATE_SESSION, *PDPNMSG_TERMINATE_SESSION;
Members
- dwSize
- Size of this structure.
- hResultCode
- Specifies how the session was terminated. This member is set to DPNERR_HOSTTERMINATEDSESSION if the session was peer-to-peer, and the host called IDirectPlay8Peer::TerminateSession. If the session was ended by the host calling IDirectPlay8Peer::Close, or if the host stops responding, hResultCode is set to DPNERR_CONNECTIONLOST.
- pvTerminateData
- Termination data. If hResultCode is set to DPNERR_HOSTTERMINATEDSESSION, pvTerminateData points to the data block that the host passed through the pvTerminateData parameter of IDirectPlay8Peer::TerminateSession.
- dwTerminateDataSize
- Size of the data block pointed to by pvTerminateData. This member will be zero if pvTerminateData is set to NULL.
Remarks
Return from the message callback function with DPN_OK.
In a peer-peer game that permits host-migration, if the current host calls IDirectPlay8Peer::Close or stops responding, the session does not terminate. Instead, the host migrates and all nonhost players receive a DPN_MSGID_DESTROY_PLAYER message for the host's players, and a DPN_MSGID_HOST_MIGRATE message for the new host. To prevent host migration, the host must shut down the session by calling IDirectPlay8Peer::TerminateSession. When the host terminates a session this way, all players receive a DPN_MSGID_TERMINATE_SESSION message with hResultCode set to DPNERR_HOSTTERMINATEDSESSION. The session will terminate, generating DPN_MSGID_DESTROY_PLAYER messages for every player.
In a peer-peer game that does not permit host-migration, the session is terminated if the host calls IDirectPlay8Peer::Close, or stops responding. In that case, DPN_MSGID_TERMINATE_SESSION is sent to all players with hResultCode set to DPNERR_CONNECTIONLOST. The session will terminate, generating DPN_MSGID_DESTROY_PLAYER messages for every player.
In a client/server game, the session is also terminated if the host calls IDirectPlay8Server::Close or stops responding. In that case, DPN_MSGID_TERMINATE_SESSION is sent to all connected clients with hResultCode set to DPNERR_CONNECTIONLOST. The DPN_MSGID_DESTROY_PLAYER message not sent to clients. If the server disconnected by calling IDirectPlay8Server::Close, it will receive DPN_MSGID_DESTROY_PLAYER messages for all players, including its own. Otherwise, the server will only receive DPN_MSGID_DESTROY_PLAYER for the clients' players.
Note The DPN_MSGID_TERMINATE_SESSION message typically arrives before any DPN_MSGID_DESTROY_PLAYER messages. However, the order of arrival is not guaranteed.
Message Information
Header dplay8.h Minimum operating systems Windows 98