As described in the thread on the RMI access to the brick, I need to set an environment property in my RMI server program running on the brick, containing the IP address that the brick can be accessed by from a client.

In case the connection to the client machine is established by WiFi, though, the actual IP address is not known at programming time.So I wonder whether there's the possibility to retrieve the WiFi IP address programmatically in the server program?

However, though everything is working fine with my WiFi connection to the brick (EV3 control, uploading and starting programs), I get an exception when calling that method in my server code as follows:

The com.sun.jna.LastErrorException (with errno 19) occurs when calling wifiDevice.getAccessPoint() and happens in NativeWifi.ioctl() called by LocalWifiDevice.getAccessPoint() on line 92 (sorry, do not know how to transport the brick's stack trace to the client machine).

The retrieval of the names of the available access points before works fine.

Why does this exception occur?And is there a more suited way to retrieve the WiFi IP address?

Hi, you do not need any leJOS/EV3 specific code to do this (the code you are trying to use is really there to allow you to configure your EV3), it is just pretty much standard Java/Linux/Networking code. basically you need to enumerate the network interfaces and obtain the IP address from them, note that the EV3 has more than one IP address (it has 3 I think), so you need to make sure you use the correct one. The menu system displays the IP address for the USB and WiFi interfaces so you could look at that code:https://sourceforge.net/p/lejos/ev3/ci/ ... java#l2163

Thanks for the hint.Indeed, by simply using the java.net API here I was able to retrieve the two IP adresses of interest in my server program (the default 10.0.1.1 one and the WiFi one); yet, I am not able to detect which one is the WiFi one (except for using rather crude and unreliable approaches like comparing display names of the associated NetWorkInterface or the likes).

Looks like the API here does not provide a "good" way to do this - the proposals in the web mostly boil down to try to access some "standard" web site over an internet socket created using the InetAddress at hand.However, I am no expert in Network programming, after all. Maybe someone else here has a good idea how to porgrammatically identify the WiFi IP address in the list.

Otherwise I might let the user select the IP address to use on startup time of the server program (which sounds like the most reliable, but also most circumstantial way to do that).

Why do you need to identify the WiFi one particularly? Isn't it possible that USB(or Bluetooth) might be being used to connect the EV3? On the EV3 I think that the network interface name for the USB/Bluetooth network will always be the same so you could potentially use that. I'm not sure that there really is a general way of detecting the "best" network, there is nothing to stop you having USB, Bluetooth and WiFi all active at once!