Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers AppGameKit Corner / GetDeviceIP returns Wifi IP address ?

Author
Message
2D Analyst
AGK Developer
19
Years of Service
User Offline
Joined: 2nd May 2004
Location:
Posted: 16th Apr 2019 00:39
I released a game on google play and it saves player's high score along with ip addresses to my server. I noticed all the IP addresses captured with GetDeviceIP() stores the internal ip address ex: 192.68.0.15 and not 70.224.242.70

I'm using PHP and so I can always use the PHP function to get the real ip address. Wouldn't it make more sense to capture the public ip address and not the internal one with GetDeviceIP() ?
SFSW
21
Years of Service
User Offline
Joined: 9th Oct 2002
Location:
Posted: 16th Apr 2019 03:52
No, not within a local app/game as it's generally the priority to capture the immediate IP address of the local network device being used as that's the route device binding/interfacing takes place with. This can vary with the type of connection being used. So if you have a direct connection to your external public IP address, that will be returned. But if you have a wi-fi router in between, then that's the device you'll be interfacing with and as such, that IP address will be retrieved (the external address can also be masked somewhat because of a router path). So if you need the external IP address, you can simply retrieve that on the PHP side of things (don't have the game try to export the IP and instead just pick it up when the game connects to your server).
Ortu
DBPro Master
16
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 16th Apr 2019 20:15 Edited at: 16th Apr 2019 22:14
If the device is on wifi or other LAN, it doesn't actually know what the network's external IP is. It will have to get that from the router, or from something beyond the router such as your web server.

In this case the device's IP is the internal network IP, it can also find the internal IP of other devices on the network including the routers internal IP but has no direct knowledge of addresses or routing past the routers internal.
http://games.joshkirklin.com/sulium

A single player RPG featuring a branching, player driven storyline of meaningful choices and multiple endings alongside challenging active combat and intelligent AI.
2D Analyst
AGK Developer
19
Years of Service
User Offline
Joined: 2nd May 2004
Location:
Posted: 21st Apr 2019 02:09
Thanks, good info.

Login to post a reply

Server time is: 2024-03-28 09:14:08
Your offset time is: 2024-03-28 09:14:08