Handling Addresses

DirectPlay

 
Microsoft DirectX 9.0 SDK Update (Summer 2003)

Handling Addresses


If you call the Host, EnumHosts, or Connect methods exposed by the IDirectPlay8Peer, IDirectPlay8Client, or IDirectPlay8Server you must pass address objects as parameters. If Microsoft® DirectPlay® does not have sufficient address information, the method that you called will fail, and it will return DPNERR_ADDRESSING. However, it is not necessary to have all the information in the address object at the time you call the method.

All address objects must have the service provider globally unique identifier (GUID) set. However, it is possible to omit other data values.

  • You can omit the device if the service provider supports all adapters.
  • You can omit the port number for Internet Protocol (IP) and Internetwork Packet Exchange (IPX) service providers for the Host, EnumHosts, and Connect methods. DirectPlay will assign a port number. This number may vary.
  • If you set the OKTOQUERYFORADDRESSING flag, the service provider can display a dialog box asking the user for the information needed to complete the address. If the user does not supply sufficient information, the method will fail. If the OKTOQUERYFORADDRESSING flag is not set, no dialog box will be displayed. If the address you pass to the method is insufficient, the method will fail. In the last two cases, the error value that is returned will be DPNERR_ADDRESSING.

There are two important issues for IP and IPX service providers that you need to be aware of. Failing to handle them properly may cause your application to fail.

  • If you set the NOBROADCASTFALLBACK flag when you call an enumeration method, you must supply a hostname. If you do not do so, the method will fail and return DPNERR_ADDRESSING.
  • If you do not specify a port, do not assume that DirectPlay will always choose the same port number. The only way to be certain of the port number is to specify it in your address. If you do not specify a port number, you must retrieve the actual value later, after the command is in progress.
Note  Application developers who choose to override the default DirectPlay 8 dialog for Transmission Control Protocol/Internet Protocol (TCP/IP) are strongly urged to implement a solution that allows the user to override the port used for a connection or enumeration. One possible solution is to enable users to follow the host name with a colon and then the port, as implemented by the default DirectPlay 8 TCP/IP protocol dialog, for example: host.domain.com:8090. Another possible solution is to add a field to the user interface (UI) that enables the user to enter a port.

© 2003 Microsoft Corporation. All rights reserved.