Handling Lost Sessions

When the host of the session quit, the connection was then dropped. There was no longer any host, so the connection couldn't be maintained any longer. DirectPlay sent a message to all connected clients informing them of this; however, we never included a handler for this event. Let's do this now:

connection.SessionTerminated += new
    SessionTerminatedEventHandler(OnSessionTerminate);

The session-terminated event can be fired when the host has quit (like we did previously) or for just about any other reason why you can no longer be in the session. For example, if you unplugged your network cable, shortly later you would receive this event because no one in the session could be contacted. We should add the code for this handler ...

Get Managed DirectX® 9 Kick Start: Graphics and Game Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.