Microsoft DirectX 8.1 (C++)

Selecting a Client/Server Host

By definition, the server application hosts the session. To join a session, a client application must determine the host server's address. A common way to select a host is through a lobby server. In that case, when a user's application is connected to the session, the connection settings that you receive with the DPL_MSGID_CONNECT message include the host's address object. The pdp8HostAddress member of the associate structure points to an address object with the host's address.

Servers using an IP or IPX service provider can also create a broadcast session, perhaps on a LAN subnet, by advertising themselves as session hosts. To create a broadcast session, call IDirectPlay8Server::SetServerInfo to specify the server settings. Then call IDirectPlay8Server::Host to advertise the server as a session host. You specify the configuration of the game by assigning values to the DPL_PROGRAM_DESC structure that is passed through the pdnAppDesc parameter of IDirectPlay8Server::Host.

To allow your user to look at the available sessions and hosts, a client application can query for available hosts by calling IDirectPlay8Client::EnumHosts. Once the user has selected a host, you can request a connection.