Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to simulate network delay on android emulator?

Tags:

android

For example:

sending "A" from app to sever takes 5 seconds. Sever responds with "B" which takes 15 seconds to arrive at the app. In adb, we can add a network delay of 5000 and delay only the outgoing traffic for 5 seconds but how can I delay the incoming traffic for 15 seconds?

like image 494
user3472537 Avatar asked May 22 '26 18:05

user3472537


1 Answers

http://developer.android.com/tools/devices/emulator.html#netdelay shows how to pass command line arguments to the emulator in order to set network delay times. E.g.

emulator -netdelay gprs

or

emulator -netdelay 20000

which sets the round-trip delay to 20 seconds.

Usually the app only sees the total round-trip delay and doesn't notice if the request delay was different than the response delay. It might make a difference if client-server clock skew matters, or if other clients are also requesting changes to shared data, but the emulator doesn't provide a way to simulate that.

like image 62
Jerry101 Avatar answered May 25 '26 08:05

Jerry101



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!