A DirectPlay session is an instance of several applications on remote computers communicating with each other. An application uses DirectPlay's session-management functions to open or close a communication channel. An application either creates a new session, or it enumerates existing sessions and finds one to connect to. The application that creates the session is referred to as the host. The host assigns player and group ID numbers and regulates new applications joining the session.
The application can use the IDirectPlay2::EnumSessions method to locate all the existing sessions in progress on the network. It can use the IDirectPlay2::Open method to create new sessions or to connect to an existing one. A session is described by its corresponding DPSESSIONDESC2 structure. This structure contains application-specific values and session particulars, such as the session's name, an optional password for the session, and the number of players permitted in the session. After it opens a session, your application can call the IDirectPlay2::GetCaps method to retrieve the speed of the communications link and other properties of the network and service provider.
The application can use the IDirectPlay2::GetSessionDesc method to obtain the session's current properties.
When an application must leave a session, it can use the IDirectPlay2::Close method. If the session host leaves the session, and the session was started by using the DPSESSION_MIGRATEHOST flag in the DPSESSIONDESC2 structure, one of the other players in the session becomes the host, and a DPSYS_HOST system message is generated.