[TIMOB-647] add subnet and external ip to platform API
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2011-04-17T01:53:48.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 1.3.0 |
Components | iOS |
Labels | n/a |
Reporter | Nolan Wright |
Assignee | Blain Hamon |
Created | 2011-04-15T02:33:38.000+0000 |
Updated | 2011-04-17T01:53:48.000+0000 |
Description
from ticket:
http://helpdesk.appcelerator.net/tickets/1653">http://helpdesk.appcelerator.net/tickets/1653
i believe these are available - see:
http://stackoverflow.com/questions/2023592/iphone-wifi-subnet-mask-and-router-address"> http://stackoverflow.com/questions/2023592/iphone-wifi-subnet-mask-...
Need more information. Does 'external ip' refer to the IP assigned to the phone, or the IP of the router?
I've gathered that this is what the user wants:
1 & 2 are possible. Getting the external IP address is much harder, unless it refers to the EDGE/3G address assigned to the phone.
Some more notes which I'll update as time goes on, germane to using getifaddrs:
en0: wifi
pdp_ip0: data network
lo0: loopback (127.0.0.1)
Note that this code will use getifaddrs() directly, which may or may not be considered "legal" under the iPhone guidelines since it's a BSD function. This is the only way to get the information; as with sockets, the system configuration framework is crippled on iPhone.
(from [b46736df8d8bbcebfe3d9c5820a7ea681db0343b]) Closes #647: 'address' now works right, 'dataAddress' and 'netmask' properties added to Platform. http://github.com/appcelerator/titanium_mobile/commit/b46736df8d8bbcebfe3d9c5820a7ea681db0343b"> http://github.com/appcelerator/titanium_mobile/commit/b46736df8d8bb...
Very important note on this fix: It's only been tested on a 2G phone. You will need to test it across a broad spectrum of devices (any model of iPod touch, 3G, 3GS) before this can be absolutely confirmed. I've closed the bug anyway.
There's no way to get a phone's external address (beyond data) simply because the phone will always reside behind a router on wifi.
Works on my 2G, but apparently not Nolan's 3GS. Rolled back the fix and reopened until we can perform some diagnostics on all platforms and add in some emulation for simulation (since right now network information doesn't work under the simulator in most cases).
Devices tested so far: 2G.
(from [1519d4247c4f8b88b966ca28b1cb38282411eb85]) Closes #647. Confirmed to work by me, matches information about other devices provided by Blain (thanks Blain). Comment on the bug again if netmask issues persist. http://github.com/appcelerator/titanium_mobile/commit/1519d4247c4f8b88b966ca28b1cb38282411eb85"> http://github.com/appcelerator/titanium_mobile/commit/1519d4247c4f8...