com.fasterxml.clustermate.service.ServerUtil Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of clustermate-service Show documentation
Show all versions of clustermate-service Show documentation
Building blocks for ClusterMate-based services and servers.
package com.fasterxml.clustermate.service;
import java.io.IOException;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.util.Collection;
import java.util.Enumeration;
public class ServerUtil
{
public static void findLocalIPs(Collection ips) throws IOException
{
Enumeration en = NetworkInterface.getNetworkInterfaces();
while (en.hasMoreElements()) {
NetworkInterface networkInt = en.nextElement();
Enumeration en2 = networkInt.getInetAddresses();
while (en2.hasMoreElements()) {
ips.add(en2.nextElement());
}
}
}
}