GetUdpStatisticsEx2 function (iphlpapi.h)

The GetUdpStatisticsEx2 function retrieves the User Datagram Protocol (UDP) statistics for the current computer. The GetUdpStatisticsEx2 function differs from the GetUdpStatisticsEx function in that GetUdpStatisticsEx2 uses a new output structure that contains 64-bit counters, rather than 32-bit counters.

Syntax

IPHLPAPI_DLL_LINKAGE ULONG GetUdpStatisticsEx2(
  [out] PMIB_UDPSTATS2 Statistics,
  [in]  ULONG          Family
);

Parameters

[out] Statistics

A pointer to a MIB_UDPSTATS2 structure that receives the UDP statistics for the local computer.

[in] Family

The protocol family for which to retrieve statistics. This parameter must be one of the following values:

Value Meaning
AF_INET
Internet Protocol version 4 (IPv4).
AF_INET6
Internet Protocol version 6 (IPv6).

Return value

If the function succeeds, the return value is NO_ERROR.

If the function fails, the return value is one of the following error codes.

Return code Description
ERROR_INVALID_PARAMETER
The Statistics parameter is NULL or does not point to valid memory, or the Family parameter is not a valid value.
ERROR_NOT_SUPPORTED
This function is not supported on the operating system on which the function call was made.
Other
Use FormatMessage to obtain the message string for the returned error.

Requirements

Requirement Value
Minimum supported client Windows 10, version 1709 [desktop apps only]
Minimum supported server Windows Server 2016 [desktop apps only]
Target Platform Windows
Header iphlpapi.h
Library Iphlpapi.lib
DLL Iphlpapi.dll

See also

GetIpStatisticsEx

GetTcpStatisticsEx

GetUdpStatistics

IP Helper Function Reference

IP Helper Start Page

MIB_UDPSTATS