Retrieving Information Using GetIpStatistics
To use GetIpStatistics
Declare some variables that are needed.
Declare a DWORD variable
dwRetvalthat will be using for error checking function calls. Declare a pointer to an MIB_IPSTATS variable called pStats, and allocate memory for the structure. Check that memory could be allocated.
- Call the GetIpStatistics function with the pStats parameter to retrieve IP statistics for the local computer. Check for errors and return the error value in the DWORD variable
dwRetval. If an error occurs, the
dwRetvalvariable can be used for more extensive error checking and reporting.
- If the call to GetIpStatistics was successful, print out some of the data in the MIB_IPSTATS structure pointed to by the pStats parameter.
- Free the memory allocated for the MIB_IPSTATS structure pointed to by the pStats parameter. This should be done once the application no longer needs the data returned by the pStats parameter.
Previous Step: Managing IP Addresses Using AddIPAddress and DeleteIPAddress
Build date: 11/16/2013