Port management helpers#

Helpers for managing port assignment.

ansys.tools.local_product_launcher.helpers.ports.find_free_ports(num_ports=1)#

Find free ports on the localhost.

Note

Because there is no way to reserve a port that would still allow a server to connect to it, there is no guarantee that the ports are still free when eventually used.

Parameters:

num_ports (int, default: 1) – Number of free ports to obtain.

Return type:

list[int]