13

I need to test my application in conditions where even 2G Internet connectivity isn't at its full coverage (i.e. 2 bars instead of 4, 2G).

I prefer conducting these tests over WiFi.

Is there a way (programmatically or otherwise) to tell the Android OS on the real device to slow down or throttle Internet connection 56 Kbit/s?

Note: I know how to do this on the emulator. I'm looking for a way to do this on a real device.

Is this possible?

Community
  • 1
  • 1
scatmoi
  • 1,958
  • 4
  • 18
  • 32
  • 1
    Check your router settings for a bandwith limiter; sometimes there's one available. – Ry- Jul 15 '12 at 02:47
  • @minitech Thanks. Any idea where bandwith limiter (for **WiFi**) can be found on a DD-WRT router? – scatmoi Jul 16 '12 at 14:05

2 Answers2

4

In one of your comments you mentioned that you have a DD-WRT router, which is really a tiny Linux box. So you may be able to get a way with the tc command:

tc qdisc add dev $DEV root handle 1: cbq avpkt 1000 bandwidth 10mbit 
tc class add dev $DEV parent 1: classid 1:1 cbq rate 512kbit allot 1500 prio 5 bounded isolated 
tc filter add dev $DEV parent 1: protocol ip prio 16 u32 match ip dst 195.96.96.97 flowid 1:1
Eternal Learner
  • 2,602
  • 5
  • 27
  • 38
0

It kind of depends on what you have on the upstream side. If you're transmitting some kind of test load, write a driver at the upstream end that does, in fact, slow itself down -- although sleep() is a bad choice. What you'll be writing is essentially a fairly hard real-time program if you hope to get anything resembling a real workload.

(When I say "a driver" btw , I don't mean necessarily a device driver, just some kind of driver program.)

But are you really trying to simulate a slow connection, or a degraded and noisy connection that has a low effective data rate?

Frederick Cheung
  • 83,189
  • 8
  • 152
  • 174
Charlie Martin
  • 110,348
  • 25
  • 193
  • 263
  • 1
    Any code **inside the application to be tested** that attempts to simulate slowness sort of defeats the purpose (ever heard of Heisenberg principle?). As for your question, ideally I would like to be able to simulate both a `slow connection` and a `degraded and noisy connection` that has a low effective data rate. But for now I'm willing to compromise for slow connection only. Do you know of an app that loads the Internet connection similar to what `CPU Burn-in` for Windows does for CPU? – scatmoi Jul 16 '12 at 14:14