Function holoscan::get_unused_network_ports

std::vector<int> holoscan::get_unused_network_ports(uint32_t num_ports = 1, uint32_t min_port = 10000, uint32_t max_port = 32767, const std::vector<int> &used_ports = {})

Generate a list of unused network ports within a specified range.

This method generates a vector of unused network ports based on the specified parameters. It uses the rand_r() method to generate random numbers.

Parameters
  • num_ports – The number of unused ports to generate (default: 1).

  • min_port – The minimum value of the port range (default: 10000).

  • max_port – The maximum value of the port range (default: 32767).

  • used_ports – The vector of ports to exclude from the generated list (default: empty).

Returns

The vector containing the generated unused network ports.

© Copyright 2022-2023, NVIDIA. Last updated on Feb 9, 2024.