Skip to main content
September 16, 2015
Question

AS3 Get IP address of android wifi tether

  • September 16, 2015
  • 1 reply
  • 837 views

i have the following code.

private function searchAvailableIP(){

       var interfaces:Vector.<NetworkInterface> = NetworkInfo.networkInfo.findInterfaces();

       var connectFlag:Boolean = false;

       var activeIP:String;

       for(var key:String in interfaces){

            if(interfaces[key].active){

                 var addresses:Vector.<InterfaceAddress> = interfaces[key].addresses;

                 for(var akey:String in addresses){

                      activeIP = addresses[akey].address;

                      connectFlag = true;

                      break;

                 }

            }

            if(connectFlag){

                 break;

            }

       }

       return activeIP;

}

This works perfectly on getting the first active WIFI IP address of my android phone, however, if my phone is on WIFI Tether mode, I am unable to get its ip address. it always returns the loop back IP which is 127.0.0.1. I checked the WIFI Tether IP of my phone, it was 192.168.43.1, how come the following code cannot detect the IP Address of the WIFI Tether?

This topic has been closed for replies.

1 reply

September 16, 2015

Anyone can help please? need answers badly.

UPDATE: i have tried to connect to the wifi tether ip address 192.168.43.1, and i could connect. I just need to find a way how to get that ip :/ i have tried to loop and display the addresses and broadcast address of all the available interfaces and their sub interfaces, even the inactive ones. I still can't get the ip address.

i think adobe doesn't support this yet

UPDATE2: I used ServerSocket and Socket to connect to the ip address

server.bind(1234, "192.168.43.1");

server.listen();

client.connect("192.168.43.1", 1234);