Jump to main content

##

# TCPIP_Helper_SecurePortGetByIndex Function

## C

    uint16_t TCPIP_Helper_SecurePortGetByIndex(
        int index,
        bool streamSocket,
        int* pnIndexes
    );

## Description

This function returns the secure TCP/UDP port situated at the internal port table requested index. It also returns the number of indexes currently in the table.

## Preconditions

TCP/IP stack properly initialized.

## Parameters

Parameters | Description
--- | ---
index | The port index to query. 0 should always be a valid index.
streamSocket | If true, a stream/TCP port is queried. Else, a datagram/UDP port is queried.
pnIndexes | Pointer to store the number of indexes that the table currently has. Could be NULL if not needed.

## Returns

- A port number corresponding to the required index.
- 0 if the corresponding slot is free or the port is not associated with the requested stream/datagram flag.

## Remarks

None.