Microsoft DirectX 9.0 SDK Update (Summer 2003) |
Testing Network Performance
Microsoft® DirectPlay® offers the DP8Sim service provider that allows you to test your DirectPlay application in a variety of network conditions, such as high latency and packet loss. The network simulator is not a replacement for testing in the real deployment environment, but it can help you predict how your application will perform.
DirectPlay also offers the DP8Sim Utility if you don't want to create your own testing environment. The main advantage of using the IDP8SimControl interface and the DP8Sim service provider in your application is that it allows you to integrate the network settings into your application's debugging user interface (UI), command line, or scripting tools instead of having to manually change the settings through the DP8Sim Utility.
Using the DP8Sim service provider
You can switch between the standard Transmission Control Protocol/Internet Protocol (TCP/IP) service provider to the DP8Sim service provider to run network simulation tests on your application. To set the network simulator as your service provider, you have three choices.
- Enumerate all service providers and then select the "DirectPlay8 TCP/IP Service Provider (Network Simulator)."
- Explicitly set the service provider globally unique identifier (GUID) with IDirectPlay8Address::SetSP.
- Call IDirectPlay8Peer::EnumServiceProviders, IDirectPlay8Server::EnumServiceProviders, or IDirectPlay8Client::EnumServiceProviders with the pguidServiceProvider set to CLSID_NETWORKSIMULATOR_DP8SP_TCPIP.
The following example shows how to explicitly set the service provider to the network simulator.
IDirectPlay8Address* g_pDeviceAddress; . . . hr = CoCreateInstance( CLSID_DirectPlay8Address, NULL, CLSCTX_INPROC_SERVER, IID_IDirectPlay8Address, (LPVOID*) &g_pDeviceAddress ); hr = g_pDeviceAddress->SetSP(&CLSID_NETWORKSIMULATOR_DP8SP_TCPIP );
When using the DP8Sim service provider, DirectPlay will set the DPNSPCAPS_NETWORKSIMULATOR in DPN_SP_CAPS.