Platform SDK: Internet Protocol Helper

GetTcpTable

The GetTcpTable function retrieves the TCP connection table.

DWORD GetTcpTable(
  PMIB_TCPTABLE pTcpTable,    // buffer for the connection table
  PDWORD pdwSize,             // size of the buffer
  BOOL bOrder                 // sort the table?
);

Parameters

pTcpTable
Pointer to a buffer that, on successful return, contains the TCP connection table as a MIB_TCPTABLE structure.
pdwSize
Specifies the size of the buffer pointed to by the pTcpTable parameter. If the buffer is not large enough to hold the returned connection table, the function sets this parameter equal to the required buffer size.
bOrder
Specifies whether the connection table should be sorted. If this parameter is TRUE, the table is sorted in order of:
  1. Local IP address
  2. Local port
  3. Remote IP address
  4. Remote port

Return Values

If the function succeeds, the return value is NO_ERROR.

If the function fails, use FormatMessage to obtain the message string for the returned error.

Requirements

  Windows NT/2000: Requires Windows NT 4.0 SP4 or later.
  Windows 95/98: Requires Windows 98.
  Header: Declared in Iphlpapi.h.
  Library: Use Iphlpapi.lib.

See Also

MIB_TCPTABLE