Hanbae Seo
- Forum posts: 2
Mar 21, 2013, 1:29:29 AM via Website
Mar 21, 2013 1:29:29 AM via Website
I am looking for ways to find a local IP address of the interface that is a counterpart to default gateway using Android API
-Environment-
1. VPN connection(OpenVPN)
-Default gateway is changed into VPN server IP
-Virtual interface(tunXX) for VPN connection is a counterpart to a default gateway
2. Interfaces & default gateway
> interfaces :
> lo inet addr:127.0.0.1
> wlan0 inet addr:150.149.131.5
> tun0 inet addr:10.8.0.14
>
> default gateway : 10.8.0.2
In other words, in this environment, I want to know "10.8.0.14" regardless of the interface name using Android API.
I cound find only a way to get default route IP address below
mSocket = new Socket(dstAddress, peerPortNum);
mStrMyIPAddr = mSocket.getLocalAddress().getHostAddress();
But, I don not want to use Socket
-Environment-
1. VPN connection(OpenVPN)
-Default gateway is changed into VPN server IP
-Virtual interface(tunXX) for VPN connection is a counterpart to a default gateway
2. Interfaces & default gateway
> interfaces :
> lo inet addr:127.0.0.1
> wlan0 inet addr:150.149.131.5
> tun0 inet addr:10.8.0.14
>
> default gateway : 10.8.0.2
In other words, in this environment, I want to know "10.8.0.14" regardless of the interface name using Android API.
I cound find only a way to get default route IP address below
mSocket = new Socket(dstAddress, peerPortNum);
mStrMyIPAddr = mSocket.getLocalAddress().getHostAddress();
But, I don not want to use Socket
Recommended editorial content
With your consent, external content is loaded here.
By clicking on the button above, you agree that external content may be displayed to you. Personal data may be transmitted to third-party providers in the process. You can find more information about this in our Privacy Policy.