开发者

What is the location for IP address of POST request prepared using ASIHTTP, if user is on 3G?

开发者 https://www.devze.com 2023-03-31 14:59 出处:网络
If I prepare an HTTP request using ASIHTTP in my iPhone app, POST it to a php site, and have the site log the IP address, and if the user is not on WiFi but using a 3G connection, what will the logged

If I prepare an HTTP request using ASIHTTP in my iPhone app, POST it to a php site, and have the site log the IP address, and if the user is not on WiFi but using a 3G connection, what will the logged IP address represent?

I happen to be interested, in particular, in getting the time zone of the users using the IP address, so I can analyze what time of day my users are using the app. Obvious开发者_开发知识库ly, I should have had the POST request include the local time zone of the user instead of just the time of day (in GMT) that the action took place. But I didn't do that, and I'm wondering whether I can still figure out the time zones of the users based on the IP address, which I was logging. For users using WiFi I can be relatively sure of what time zone they were in. But what if the users were on 3G?


The IP address is ... whatever their carrier assigns to them. It's likely that it's local to the tower they're on, but there's no guarantee of that.


Chances are that it will be an IP that closely represents the area that they are currently in.


Virtually all cell providers use NAT gateways for their data network exit points. It is highly unlikely that a phone would ever get a non-private IP (it'll be 192.168.x.x, 10.x.x.x, 172.[16-31].x.x).

As such, while your phone itself will be posting from one of those IPs, the site that's receiving the post will see the IP of the cellprovider's gateway.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号