Microsoft DirectX 9.0 SDK Update (Summer 2003) |
Source: (SDK root)\Samples\C++\DirectPlay\NATResolver
Executable: (SDK root)\Samples\C++\DirectPlay\NATResolver
When the sample starts, an IDirectPlay8NATResolver object is created that waits for queries. The sample always listens on all available Internet Protocol, version 4 (IPv4) devices for incoming queries. If Require password is checked, queries are first screened for the plain text password before allowing Microsoft® DirectPlay® to return the resolved address.
The dialog displays the list of addresses currently in use, as well as the number of incoming queries and outgoing responses.
DirectPlay handles most of the address resolution work, interrupting only to check that incoming queries are from authorized clients. The IDirectPlay8NATResolver::Initialize method sets up the message callback for client authorization, and the IDirectPlay8NATResolver::Start method starts the server on the requested device.
DirectPlay informs your program about client queries with DPN_MSGID_NAT_RESOLVER_QUERY messages, which contain the client address and given password. A successful return value from this callback instructs DirectPlay to handle the address resolution. A failed return value cancels the resolution but continues executing the associated DirectPlay call. Using the password allows you to deny access to your resolution server for clients who are not part of your game.