private static InetAddress getIP(String ifacename) throws SocketException, UnknownHostException {
		Enumeration<NetworkInterface> ifs = NetworkInterface.getNetworkInterfaces();
		NetworkInterface iface;
		Enumeration<InetAddress> addresses;
		InetAddress ip;
		while(ifs.hasMoreElements() && (iface = ifs.nextElement()) != null)
		{
			if(iface.getDisplayName().equals(ifacename)) {
				addresses = iface.getInetAddresses();
				
				while(addresses.hasMoreElements() && (ip = addresses.nextElement()) != null) {
					if(ip instanceof Inet4Address) {
						return ip;
					}
				}
			}
		}
		return InetAddress.getLocalHost();
	}