What are these various settings in Charles proxy? - charles-proxy

Screenshot of Charles proxy throttle setting
Can anyone describe them in layman terms?

I've never used this option in Charles Proxy, but I did on Chrome.
"Throttling" has to do with regulating network speed, so by this feature you can simulate poorer connection speed, as if connecting with 2G, 3G or so.
This is useful to detect problems that only arise when timeouts occur, for example.
(please note that, obviously, you will not be able to simulate higher speeds than the one provided by your ISP)

Related

Is using airplane mode an acceptable way to test a lack of connection?

We are in the process of developing an method of caching so that our app can continue to operate in an area with very little/no signal.
Obviously users will try to continue to use functions that require data and we need to handle the inevitable failure of these requests appropriately.
Essentially we are sat in the office, switching airplane mode on and off to simulate entering/exiting signal then adjusting our app to fix any issues this may arise.
What I'd like to know is, is using airplane mode going to give us a reasonable simulation of entering/exiting an area with no data or are there other implications?
I've seen questions raising the issue that the 3G/EDGE connection may not always wake up after airplane mode is switched on - while I appreciate this method is no way as good as actually being out in the field testing, if we can get a reasonable simulation and account for the majority of the problems that arise then I think this is an acceptable tradeoff.
I apologise if this has been asked before, I did do a search on here & on google but couldn't find any appropriate results.
You should try the Network Link Conditioner
There is a WWDC 2012 session called Networking Best Practices that mentions it (but he does not explain how to use it there).
To get it, you have to go to XCode/Open Developer Tool/More Developer Tools.. and download the latest Hardware IO Tools for XCode.
Once you install it from the IO Tools pkg, "Network Link Conditioner" will appear in System Preferences
You can then do something like 100% packet loss to simulate one of those routers that pretends you are connected but actually doesn't work.
On iOS, the network link conditioner is under Settings / Developer (you must have enabled Developer mode in XCode first to see it)
The main problem is that in the Airplane Mode the networking operations fail fast, while spotty mobile signal will lead to timeouts and a-few-bytes-an-hour speeds. This is usually a significant difference from the UI viewpoint. (It might be worth a try to use some bandwidth throttle to starve the testing machine and see how it behaves when the network starts to break?)
A few years back, when testing remote devices which used the cell network to communicate with the 'home base', we did things like move them into a shielded room (make shift), place large shields on three of four sides to force them to connect to a certain tower (and therefore, network), etc. Brute force physical methods. Since this actually cuts off the signal, it may be a more realistic approach.
You may also want to try this through your wlan-router. First, disable data roaming on your iPhone. Then, let the iPhone be connected to the internet through your wlan network. Then, disconnect the gateway on your wlan router while your iPhone is still connected to the wlan network.
This depends on what failure modes you are trying to test.
I use Airplane mode as a first pass check to make sure an app submission isn't quickly rejected.
Other network failure handling checks might include:
3G only (no wifi).
WIFI only (in Airplane mode).
Pulling the power cord on the WIFI access point.
Pulling the network cable from the back of the WIFI access point after connecting to it (Reachability may falsely say yes).
Walking in and out of a basement
elevator (or other Faraday cage) in the middle of a transfer.
Driving between 2 cell towers during a data transfer.
Walking between 2 enabled WIFI access points between connection and data transfer.
Starting the app after more than 30 minutes of device inactivity (radios may be idle).
Running the app while another app (Safari, Mail) is downloading in the background.
etc.

How to detect/prevent wifi timeouts on iPhone?

I dont think this is possible, but can client connected to a wifi hotspot detect or even prevent a disconnect due to a timeout?
My guess is that this is not possible as i would imagine this timeout would be a router thing rather than a client thing.
And if a client makes an intervaled ping (e.g. ip address), would this prevent the client from being timed out?
I think that WiFi timeout detection is probably going to be a waste of your time. I would just assume you have connectivity but then include error correction and tell the user if you couldn't get the data.
Oh, and if we were good enough programmers to prevent timeouts... We wouldn't be writing iPhone apps.
If you just make random pings all the time, you're going to A) slow the phone and B) not solve the problem. Timeouts happen for all sorts of reasons, and pinging probably won't prevent it.
On the other hand, if you really want to know about network state... Apple has this:
http://developer.apple.com/library/ios/#samplecode/Reachability/Introduction/Intro.html
I should also note that ASIHTTPRequest has this stuff built in... As far as I know, anyway - it requires it to compile on iPhone.

Measure network traffic programmatically on iPhone

I'm interested in measuring the network traffic for my application. Ideally I would need to separate wireless from 3G network traffic. I can't seem to find any API that gets this information; however I see that there is at least one app in the AppStore that does something close (they actually sum up the traffic for the entire phone).
Any ideas?
I've found one approximate solution: getifaddrs can be used to get statistics on network usage.
One advantage is that it can get separate statistics for Wi-Fi and WWAN interfaces.
A disadvantage is that on multi-tasking devices those interfaces may be used by multiple applications and the statistics are cumulated.
I also was looking for solution and found it here:
iPhone Data Usage Tracking/Monitoring
Please take a look this post, it provides all info that you need.

iPhone cookie/caching issue on 3G, fine over wifi

I'm having trouble with an old pre-mobile website which uses PHP, MySQL, cookies and HTML forms to log users in, and then track their session (it's a calendar app and messageboard). When my iPhone is attached to my wifi network at home, all is well, but when I switch to 3G the cookies no longer function and the session is dropped.
I read another thread:
Web site exhibits JavaScript error on iPad / iPhone under 3G but not under WiFi
in which the poster was experiencing a javascript issue on 3G but not on WiFi, and the suggestion was that the cellular carrier (O2 in his case, Orange UK in my case) itself was messing with the HTTP data going across 3G, but not WiFi. The fix was to use more javascript to prevent inlining of includes.
Does anyone think that my cookie and session problems are possibly caused by a similar issue, and if not can anyone think of an alternative explanation and ideally a fix?
Aha - I found out what the problem was. The cookie control on the site in question was actually being run by an installation of phpBB, which uses IP binding as a security measure. This checks off the IP addresses of successive requests within a session and drops it if they don't match. Must be the case that over wifi I have an unchanging IP, while Orange UK must bounce around several IP addresses when I run over 3G. Solved the problem by turning down the IP binding in phpBB (you can ask it to compare the whole address or just the first 2 or 3 bytes instead).
I'm guessing your 3G provider is proxying your HTTP somehow. It's common for some (in my opinion, crappier) ISPs to do this. That would be an explanation of why it is behaving differently to the same browser on another connection.
Lots of people will access your site over a proxy such as Squid. You need to fix this so it works or you might inadvertently block access to some people.
My guess is that your code may just be setting cookies in a particular way which is forgiven by browsers but not supported by that particular proxy. I'd start troubleshooting by specifying the domain, expiry in different ways (with dot at start of domain and without, with quotes around domain/path and without) and turning on or off Cookie2 features or HTTP-only features.
Is there an HTTP header viewer for the iPhone browser? If not try tethering it and use something like LiveHTTPheaders in Firefox (keep in mind that if your network can detect tethering it could in theory turn on/off its proxy based on whether you tether).
You'd probably have to post your code or an HTTP transcript (just the headers) for people to diagnose further.

Best software product to simulate connectivity issues for mobile testing

I need a product to simulate network latency for testing mobile applications (in particular iphone and android). I plan to set up a wifi router connected to a linux box, and write a number of scripts to approximate different types of connectivity issues.
So far, I've taken a cursory look at Netem and ns-2 (or its offspring ns-3). Netem looks very easy to deploy and configure, but they both look like they'll require some in-depth investigation.
Does anyone have positive/negative experiences with either of those solutions that they could share? Or maybe used a different solution for this problem?
If anyone comes here looking for tips, I've found a solution that seems to work well.
Ubuntu comes with Netem installed, so I went ahead and just made use of that. Basically, I got a computer with two ethernet ports, forwarded one to the other and applied Netem latency settings to the connection. Then I attached a wireless router to one, and LAN to the other. Netem lets me play with all kinds of latency and packet loss settings.
Btw, I also tried to use a few different laptops and set the internal wireless card up as an ad-hoc wireless router. I got it working for the most part, but finding a laptop with an internal wireless card that plays nice with ad-hoc in Linux is tricky at best... can't recommend it.