Class SocketUtils

java.lang.Object
io.micronaut.core.io.socket.SocketUtils

public class SocketUtils extends Object
Utility methods for dealing with sockets.
Since:
1.0
Author:
Graeme Rocher
  • Field Details

  • Constructor Details

    • SocketUtils

      public SocketUtils()
  • Method Details

    • findAvailableTcpPort

      public static int findAvailableTcpPort()
      Finds an available TCP port.
      Returns:
      The available port
    • findAvailableTcpPort

      public static int findAvailableTcpPort(int minPortRange, int maxPortRange)
      Finds an available TCP port.
      Parameters:
      minPortRange - The minimum port range
      maxPortRange - The maximum port range
      Returns:
      The available port
    • isTcpPortAvailable

      public static boolean isTcpPortAvailable(int currentPort)
      Check whether the given TCP port is available.
      Parameters:
      currentPort - The port
      Returns:
      True if it is