Fortunately for me, Android is a pretty familiar environment. With the help of Stackoverflow, I was able to put together a function and add it to the brl socket.java that does something like:
String GetLocalIPAddress() {
String hostAddress = "127.0.0.1";
try {
for (Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces(); en.hasMoreElements();) {
NetworkInterface intf = en.nextElement();
for (Enumeration<InetAddress> enumIpAddr = intf.getInetAddresses(); enumIpAddr.hasMoreElements();) {
InetAddress inetAddress = enumIpAddr.nextElement();
if (!inetAddress.isLoopbackAddress()) {
hostAddress = inetAddress.getHostAddress().toString();
}
}
}
} catch (SocketException ex) {
// Log.e("ServerActivity", ex.toString());
}
return hostAddress;
}
Now, the GLFW, iOS, etc. That's tough for me, not sure what I'm doing, but may have found a cpp solution that I'm trying to hack together at the moment.
|