GetPortsFreeWithLimit

Retrieve up to limit free (unused) ports according to the current SDK settings.

int GetPortsFreeWithLimit(unsigned int limit, uint32_t** outPtr, int* outLen)

Parameters

  • limit: Maximum number of free ports to return.

Return Value

  • int: 0 if success.

  • outPtr: Pointer to an array of free ports (must be freed with FreeBuf).

  • outLen: Number of ports in outPtr.

Example

// example

uint32_t* out = NULL; 
int n = 0;
GetPortsFreeWithLimit(5, &out, &n);
if (out) { 
    for (int i = 0; i < n; i++) {
        printf("Free port: %u\n", out[i]);
    }
    FreeBuf(out);
}

Last updated

Was this helpful?