Freigeben über


GetTcpTable (Compact 2013)

3/26/2014

This function retrieves the TCP connection table.

Syntax

DWORD GetTcpTable(
  PMIB_TCPTABLE pTcpTable, 
  PDWORD pdwSize, 
  BOOL bOrder 
);

Parameters

  • pTcpTable
    [out] Pointer to a buffer that contains the TCP connection table as a MIB_TCPTABLE structure.
  • pdwSize
    [in, out] On input, specifies the size in bytes of the buffer pointed to by the pTcpTable parameter.

    On output, if the buffer is not large enough to hold the returned connection table, the function sets this parameter equal to the required buffer size in bytes.

  • bOrder
    [in] A Boolean value that specifies whether the TCP connection table should be sorted. If this parameter is TRUE, the table is sorted in the order of:

    1. Local IP address
    2. Local port
    3. Remote IP address
    4. Remote port

Return Value

Return code

Description

NO_ERROR

The function succeeds.

ERROR_INSUFFICIENT_BUFFER

The buffer pointed to by the pTcpTable parameter is not large enough. The required size is returned in the DWORD variable pointed to by the pdwSize parameter.

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

ERROR_INVALID_PARAMETER

The pdwSize parameter is NULL, or GetTcpTable is unable to write to the memory pointed to by the pdwSize parameter.

ERROR_NOT_SUPPORTED

This function is not supported on the operating system in use on the local system.

Other

Use FormatMessage to obtain the message string for the returned error.

Remarks

On the Windows SDK, the return value from the GetTcpTable function is changed to a data type of ULONG which is equivalent to a DWORD.

Requirements

Header

iphlpapi.h

Library

Iphlpapi.lib

See Also

Reference

IP Helper Functions
GetExtendedTcpTable
GetOwnerModuleFromTcpEntry
GetTcp6Table
GetTcp6Table2
GetTcpStatistics
GetTcpStatisticsEx
GetTcpTable2
MIB_TCPROW
MIB_TCPROW_OWNER_MODULE
MIB_TCPROW_OWNER_PID
MIB_TCPTABLE
MIB_TCPTABLE_OWNER_MODULE
MIB_TCPTABLE_OWNER_PID
SetTcpEntry
MIB_TCPTABLE