Created
June 30, 2011 01:48
-
-
Save djKianoosh/1055469 to your computer and use it in GitHub Desktop.
List out network interfaces
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def interfaces = NetworkInterface.getNetworkInterfaces() | |
while (interfaces.hasMoreElements()) { | |
def addresses = interfaces.nextElement().getInetAddresses() | |
while (addresses.hasMoreElements()) { | |
println addresses.nextElement().getHostAddress() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
InetAddress.getLocalHost().getCanonicalHostName().toLowerCase()