Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

AS3 Get IP address of android wifi tether

Guest
Sep 15, 2015 Sep 15, 2015

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?

TOPICS
ActionScript
829
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Sep 16, 2015 Sep 16, 2015
LATEST

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);

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines