Skip to content

Instantly share code, notes, and snippets.

@djKianoosh
Created June 30, 2011 01:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save djKianoosh/1055469 to your computer and use it in GitHub Desktop.
Save djKianoosh/1055469 to your computer and use it in GitHub Desktop.
List out network interfaces
def interfaces = NetworkInterface.getNetworkInterfaces()
while (interfaces.hasMoreElements()) {
def addresses = interfaces.nextElement().getInetAddresses()
while (addresses.hasMoreElements()) {
println addresses.nextElement().getHostAddress()
}
}
@djKianoosh
Copy link
Author

InetAddress.getLocalHost().getCanonicalHostName().toLowerCase()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment