added getMyIpv4Address to NetworkUtils
package eu.modernmt.io;
-import com.sun.org.apache.xpath.internal.SourceTree;
import org.apache.commons.io.IOUtils;
import java.io.*;
@@ -12,6 +11,14 @@ import java.util.concurrent.TimeUnit;
*/
public class NetworkUtils {
+ /**
+ * This method gets the first IPV4 address
+ * that this machine is working on.
+ */
+ public static String getMyIpv4Address() throws UnknownHostException {
+ return Inet4Address.getLocalHost().getHostAddress();
+ }
+
public static boolean isAvailable(int port) {
ServerSocket ss = null;
DatagramSocket ds = null;
