Microsoft DirectX 9.0

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 Internet Protocol (IP) or Internetwork Packet Exchange (IPX) service provider can also create a session perhaps on a local area network (LAN) subnet, by advertising themselves as session hosts. To create a 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 DPN_APPLICATION_DESC structure that is passed through the pdnAppDesc parameter of IDirectPlay8Server::Host.

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

© 2002 Microsoft Corporation. All rights reserved.