DirectX SDK |
The DirectPlay addresses obtained when DirectPlay enumerates connections are simply registered DirectPlay providers that the user can choose from, and do not necessarily contain all the information needed to establish a connection. When one of these addresses is used to enumerate sessions, the service provider might ask the user for more information.
For example, if the user selects "Modem Connection for DirectPlay" from a list of service providers and the application initializes that connection and then begins session enumeration, a dialog box asks the user to select a modem and enter a telephone number. If the user cancels this dialog, he or she cannot join an existing session, though it is still possible to create one. If the user chooses to create a session, the service provider displays another dialog box giving an opportunity to choose and configure a modem for answering a call.
Sometimes this might not be the desired behavior. An application might already have the necessary connection information (for example, the IP address of a central site where games are being hosted), or it might get the information from the user through its own interface. In this case, the application can pass the complete connection information to IDirectPlay4::InitializeConnection and thus prevent the service provider from asking for more.
To create a DirectPlay address, call the IDirectPlayLobby3::CreateAddress or IDirectPlayLobby3::CreateCompoundAddress methods. CreateAddress can be used only for simple addresses containing a single element—for example, an IP address. CreateCompoundAddress can be used to create more complex addresses, such as a telephone address that includes both a modem and a phone number. For the types of elements defined by DirectPlay, see DirectPlay Address Data Types.
Sometimes this might not be the desired behavior. An application might already have the necessary connection information (for example, the IP address of a central site where games are being hosted), or it might get the information from the user through its own interface. In this case, the application can pass the complete connection information to DirectPlay4.InitializeConnection and thus prevent the service provider from asking for more.
The DirectPlayLobby3 class has the following methods for creating various kinds of DirectPlayAddress objects: