mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
@@ -160,8 +160,9 @@ public class NetUtil {
|
||||
*/
|
||||
public static int getUsableLocalPort(int minPort, int maxPort) {
|
||||
for (int i = minPort; i <= maxPort; i++) {
|
||||
if (isUsableLocalPort(RandomUtil.randomInt(minPort, maxPort + 1))) {
|
||||
return i;
|
||||
int randomPort = RandomUtil.randomInt(minPort, maxPort + 1);
|
||||
if (isUsableLocalPort(randomPort)) {
|
||||
return randomPort;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user