NVIDIA Holoscan SDK v2.3.0
Holoscan v2.3.0

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 = {}, const std::vector<int> &prefer_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. The generated ports are guaranteed to be unused at the time of generation. The generated ports can be used to bind to a network socket. The generated ports are not guaranteed to remain unused after generation.

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).

  • prefer_ports – The vector of ports to prefer in the generated list (default: empty).

Returns

The vector containing the generated unused network ports.

Previous Function holoscan::get_preferred_network_ports
Next Function holoscan::get_well_formed_name
© Copyright 2022-2024, NVIDIA. Last updated on Sep 6, 2024.