/** * Find the requested number of available UDP ports, each randomly selected * from the range [{@value #PORT_RANGE_MIN}, {@value #PORT_RANGE_MAX}]. * @param numRequested the number of available ports to find * @return a sorted set of available UDP port numbers * @throws IllegalStateException if the requested number of available ports could not be found */ public static SortedSet<Integer> findAvailableUdpPorts(int numRequested) { return findAvailableUdpPorts(numRequested, PORT_RANGE_MIN, PORT_RANGE_MAX); }
/** * Find the requested number of available UDP ports, each randomly selected * from the range [{@value #PORT_RANGE_MIN}, {@value #PORT_RANGE_MAX}]. * @param numRequested the number of available ports to find * @return a sorted set of available UDP port numbers * @throws IllegalStateException if the requested number of available ports could not be found */ public static SortedSet<Integer> findAvailableUdpPorts(int numRequested) { return findAvailableUdpPorts(numRequested, PORT_RANGE_MIN, PORT_RANGE_MAX); }
private void findAvailableUdpPorts(int numRequested, int minPort, int maxPort) { SortedSet<Integer> ports = SocketUtils.findAvailableUdpPorts(numRequested, minPort, maxPort); assertAvailablePorts(ports, numRequested, minPort, maxPort); } private void assertPortInRange(int port, int minPort, int maxPort) {
private void findAvailableUdpPorts(int numRequested) { SortedSet<Integer> ports = SocketUtils.findAvailableUdpPorts(numRequested); assertAvailablePorts(ports, numRequested, PORT_RANGE_MIN, PORT_RANGE_MAX); }
/** * Find the requested number of available UDP ports, each randomly selected * from the range [{@value #PORT_RANGE_MIN}, {@value #PORT_RANGE_MAX}]. * @param numRequested the number of available ports to find * @return a sorted set of available UDP port numbers * @throws IllegalStateException if the requested number of available ports could not be found */ public static SortedSet<Integer> findAvailableUdpPorts(int numRequested) { return findAvailableUdpPorts(numRequested, PORT_RANGE_MIN, PORT_RANGE_MAX); }
/** * Find the requested number of available UDP ports, each randomly selected * from the range [{@value #PORT_RANGE_MIN}, {@value #PORT_RANGE_MAX}]. * @param numRequested the number of available ports to find * @return a sorted set of available UDP port numbers * @throws IllegalStateException if the requested number of available ports could not be found */ public static SortedSet<Integer> findAvailableUdpPorts(int numRequested) { return findAvailableUdpPorts(numRequested, PORT_RANGE_MIN, PORT_RANGE_MAX); }