Skip to content

Instantly share code, notes, and snippets.

@badvision
Created May 19, 2016 20:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save badvision/8acd2548592a5a67ec36c34fb05a2f40 to your computer and use it in GitHub Desktop.
Save badvision/8acd2548592a5a67ec36c34fb05a2f40 to your computer and use it in GitHub Desktop.
List all IP Addresses that the server is listening on.
<%@page session="false" contentType="text/html; charset=utf-8"
import="java.util.*,java.net.*"%><%
List<NetworkInterface> ifaces = Collections.list(NetworkInterface.getNetworkInterfaces());
for(NetworkInterface ifc : ifaces) {
if(ifc.isUp()) {
List<InetAddress> addrs = Collections.list(ifc.getInetAddresses());
for(InetAddress addr : addrs) {
%>
<%=addr.getHostAddress()%><br>
<%
}
}
}
%>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment