Microsoft DirectX 9.0 SDK Update (Summer 2003) |
In a peer-to-peer Microsoft® DirectPlay® network session, one client of the networking session acts as host. If that host exits the session or stops responding for any reason, another client in the session is elected as host.
In a DirectPlay voice session, a similar process of host migration occurs in peer-to-peer voice sessions, except that the voice host migrates independently of the DirectPlay network session. The voice host migrates when the server calls IDirectPlayVoiceServer::StopSession or if the voice host stops responding.
When the voice host migrates, the new host's voice client message handler receives a DVMSGID_LOCALHOSTSETUP message. The primary purpose of this message is to allow the new host to provide DirectPlay with a pointer to the callback message handler that will receive voice server messages. To specify your callback message handler, set the value of the pMessageHandler member of the DVMSGID_LOCALHOSTSETUP structure to point to your voice server message handler before you return from the client message handler. The new host can also specify a voice server context value by setting the value of the pvContext member of the structure.
Each client in the voice session receives a DVMSGID_HOSTMIGRATED message with the DVID of the new host. The client that is chosen as the new host also receives a valid IDirectPlayVoiceServer pointer, which the client can use to call the voice server methods. The new host does not receive DVMSGID_HOSTMIGRATED until after it has processed DVMSGID_LOCALHOSTSETUP.