Windows Dev Center

Collapse the table of content
Expand the table of content
Expand Minimize

GetExtendedUdpTable function

The GetExtendedUdpTable function retrieves a table that contains a list of UDP endpoints available to the application.

Syntax


DWORD GetExtendedUdpTable(
  _Out_   PVOID           pUdpTable,
  _Inout_ PDWORD          pdwSize,
  _In_    BOOL            bOrder,
  _In_    ULONG           ulAf,
  _In_    UDP_TABLE_CLASS TableClass,
  _In_    ULONG           Reserved
);

Parameters

pUdpTable [out]

A pointer to the table structure that contains the filtered UDP endpoints available to the application. For information about how to determine the type of table returned based on specific input parameter combinations, see the Remarks section later in this document.

pdwSize [in, out]

The estimated size of the structure returned in pUdpTable, in bytes. If this value is set too small, ERROR_INSUFFICIENT_BUFFER is returned by this function, and this field will contain the correct size of the structure.

bOrder [in]

A value that specifies whether the UDP endpoint table should be sorted. If this parameter is set to TRUE, the UDP endpoints in the table are sorted in ascending order, starting with the lowest local IP address. If this parameter is set to FALSE, the UDP endpoints in the table appear in the order in which they were retrieved.

The following values are compared as listed when ordering the UDP endpoints:

  1. Local IP address
  2. Local scope ID (applicable when the ulAf parameter is set to AF_INET6)
  3. Local UDP port
ulAf [in]

The version of IP used by the UDP endpoint.

ValueMeaning
AF_INET

IPv4 is used.

AF_INET6

IPv6 is used.

 

TableClass [in]

The type of the UDP table structure to retrieve. This parameter can be one of the values from the UDP_TABLE_CLASS enumeration.

On the Windows SDK released for Windows Vista and later, the organization of header files has changed and the UDP_TABLE_CLASS enumeration is defined in the Iprtrmib.h header file, not in the Iphlpapi.h header file.

The UDP_TABLE_CLASS enumeration value is combined with the value of the ulAf parameter to determine the extended UDP information to retrieve.

Reserved [in]

Reserved. This value must be zero.

Return value

If the call is successful, the value NO_ERROR is returned.

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

Return codeDescription
ERROR_INSUFFICIENT_BUFFER

An insufficient amount of space was allocated for the table. The size of the table is returned in the pdwSize parameter, and must be used in a subsequent call to this function in order to successfully retrieve the table.

This error is also returned if the pUdpTable parameter is NULL.

ERROR_INVALID_PARAMETER

An invalid parameter was passed to the function. This error is returned if the TableClass parameter contains a value that is not defined in the UDP_TABLE_CLASS enumeration.

 

Remarks

The table type returned by this function depends on the specific combination of the ulAf parameter and the TableClass parameter.

When the ulAf parameter is set to AF_INET, the following table indicates the UDP table type to retrieve in the structure pointed to by the pUdpTable parameter for each possible TableClass value.

TableClass valuepUdpTable structure
UDP_TABLE_BASIC MIB_UDPTABLE
UDP_TABLE_OWNER_MODULE MIB_UDPTABLE_OWNER_MODULE
UDP_TABLE_OWNER_PID MIB_UDPTABLE_OWNER_PID

 

When the ulAf parameter is set to AF_INET6, the following table indicates the TCP table type to retrieve in the structure pointed to by the pUdpTable parameter for each possible TableClass value.

TableClass valuepUdpTable structure
UDP_TABLE_BASIC MIB_UDP6TABLE
UDP_TABLE_OWNER_MODULE MIB_UDP6TABLE_OWNER_MODULE
UDP_TABLE_OWNER_PID MIB_UDP6TABLE_OWNER_PID

 

The GetExtendedUdpTable function when called with the ulAf parameter set to AF_INET6 and the TableClass set to UDP_TABLE_BASIC is only supported on Windows Vista and later.

On Windows Server 2003 with Service Pack 1 (SP1) and Windows XP with Service Pack 2 (SP2), the GetExtendedUdpTable function called with the ulAf parameter set to AF_INET6 and the TableClass set to UDP_TABLE_BASIC fails and returns ERROR_NOT_SUPPORTED.

On the Windows SDK released for Windows Vista and later, the organization of header files has changed. The various MIB_UDPTABLE structures are defined in the Udpmib.h header file, not in the Iprtrmib.h header file. Note that the Udpmib.h header file is automatically included in Iprtrmib.h, which is automatically included in the Iphlpapi.h header file. The Udpmib.h and Iprtrmib.h header files should never be used directly.

Requirements

Minimum supported client

Windows Vista, Windows XP with SP2 [desktop apps only]

Minimum supported server

Windows Server 2008, Windows Server 2003 with SP1 [desktop apps only]

Header

Iphlpapi.h

Library

Iphlpapi.lib

DLL

Iphlpapi.dll

See also

MIB_UDP6TABLE
MIB_UDP6TABLE_OWNER_MODULE
MIB_UDP6TABLE_OWNER_PID
MIB_UDPTABLE
MIB_UDPTABLE_OWNER_MODULE
MIB_UDPTABLE_OWNER_PID
UDP_TABLE_CLASS

 

 

Community Additions

ADD
Show:
© 2015 Microsoft