Ejemplo n.º 1
0
 /**
  * Find the requested number of available TCP ports, each randomly selected from the range [{@code
  * minPort}, {@code maxPort}].
  *
  * @param numRequested the number of available ports to find
  * @param minPort the minimum port number
  * @param maxPort the maximum port number
  * @return a sorted set of available TCP port numbers
  * @throws IllegalStateException if the requested number of available ports could not be found
  */
 public static SortedSet<Integer> findAvailableTcpPorts(
     int numRequested, int minPort, int maxPort) {
   return SocketType.TCP.findAvailablePorts(numRequested, minPort, maxPort);
 }
Ejemplo n.º 2
0
 /**
  * Find an available TCP port randomly selected from the range [{@code minPort}, {@code maxPort}].
  *
  * @param minPort the minimum port number
  * @param maxPort the maximum port number
  * @return an available TCP port number
  * @throws IllegalStateException if no available port could be found
  */
 public static int findAvailableTcpPort(int minPort, int maxPort) {
   return SocketType.TCP.findAvailablePort(minPort, maxPort);
 }