If you are developing an iOS app that communicates with a server over the network, the Network Link Conditioner is an invaluable tool. You can use the tool to “condition” the network communication to simulate various network conditions. ProTip: You never ship an app which requires network communications without putting it through the wringer with the Network Link Conditioner tool. Details on the Network Link Conditioner available here.
Often times, you need to develop against a server running on localhost while running your app on a simulator. This may be because you don’t have access to the remote server or you don’t have network connection for instance.
So how do you simulate different network conditions when testing against localhost server? Or what if you wanted to selectively throttle traffic ? A network Link Conditioner cannot be used to condition local loopback connections and it impacts all traffic flowing through the network interface.
So here is a really awesome preference pane called SpeedLimit which can be used to condition loopback connections and selectively throttle network traffic based on ports.
- You can download and install it from here
You may have to tweak your Mac's Security & Privacy preferences so as to allow the download.
- Once installed, you can launch SpeedLimit from System Preferences.
Set the host as “localhost” , set the port, select the speed and select “Slow Down” to slow down the network. Sometimes, you may have to set up the host as the local loopback address “127.0.0.1”
The revert back , press “Speed Up” button