Class InetHelper
java.lang.Object
com.github.thought2code.mcp.annotated.util.InetHelper
Utility class for network-related operations.
This class provides helper methods for working with network interfaces and addresses. It is designed to be a static utility class and cannot be instantiated.
- Author:
- codeboyzhou
-
Method Summary
Modifier and TypeMethodDescriptionstatic InetAddressFinds and returns the first non-loopback IPv4 address available on the system.
-
Method Details
-
findFirstNonLoopbackAddress
Finds and returns the first non-loopback IPv4 address available on the system.This method iterates through all available network interfaces and returns the first IPv4 address that is not associated with a loopback, virtual, or down interface. If no suitable address is found or an exception occurs, the loopback address (127.0.0.1) is returned as a fallback.
- Returns:
- the first non-loopback IPv4 address, or the loopback address if none is found
-