> 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/createproxybyportconfigs.md).

# CreateProxyByPortConfigs

Forwards multiple proxies based on a list of ports. Proxy information is taken from existing configured ports; any port without configuration is skipped.

{% code overflow="wrap" %}

```c
int CreateProxyByPortConfigs(char* requestId, char* plan, uint32_t* ports, int n, uint32_t** outPtr, int* outLen)
```

{% endcode %}

***

## Parameters

* **requestId** (char\*): Correlation ID used to receive success/failure status via events.
* **plan** (char\*): Plan ID (default “1”).
* **ports** (uint32\_t\*): Input array of ports to forward.
* **n** (int): Number of elements in ports.
* **outPtr** (uint32\_t\*\*): Output pointer that will receive a heap-allocated array of successfully forwarded ports. Must be freed with FreeBuf().
* **outLen** (int\*): Output count of elements written to outPtr.

## Return Value

* int: 0 on success; non-zero on error.

{% hint style="info" %}

## NOTE

* Action type defaults to "manual" internally; there is no actionType parameter for this function.
* When the function returns 0 but outLen is 0, no ports were forwarded (all skipped or failed).
* Caller must FreeBuf(outPtr) when outPtr is non-NULL.
  {% endhint %}

## Example

```c
// example

uint32_t inPorts[]={60001,60002,60003};
uint32_t* out=NULL; int m=0;
if (CreateProxyByPortConfigs("px","pro",inPorts,3,&out,&m)==0 && out){
  for(int i=0;i<m;i++) printf("OK %u\n", out[i]);
  FreeBuf(out);
}

```
