Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
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);
Find more inspiration, events, and resources on the new Adobe Community
Explore Now