org.springframwork.util.SocketUtils
has been deprecated in spring boot 3. Please provide a code snippet on how to find free ports within a specified range.
I am interested in alternate solutions for SocketUtils.findAvailableTcpPorts(requestedNumberOfPorts, minimumPortValue, maximumPortValue)
which would return any requested no. of ports from a specified range and SocketUtils.findAvailableTcpPort(minimumPortValue, maximumPortValue)
Another alternative is to use Java's ServerSocket class to find available TCP ports. Here's a code snippet how you can do it, HTH.