mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
commit
8529787c7b
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user