> For the complete documentation index, see [llms.txt](https://docs.9proxy.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.9proxy.com/developers/sdk/sdk-native-c/functions/getports.md).

# GetPorts

Retrieve all ports defined in the current SDK settings.

```c
int GetPorts(uint32_t** outPtr, int* outLen)
```

***

## Parameters

* none (results are returned via outPtr and outLen).

## Return Value

* int: 0 if success.
* outPtr: Pointer to an array of all ports (must be freed with FreeBuf).
* outLen: Number of ports in outPtr.

## Example

```c
// example

uint32_t* arr=NULL; int n=0;
if (GetPorts(&arr,&n)==0 && arr){ FreeBuf(arr);}

```
