Possible Duplicate:
Calculating Connection/Download Speed
I put data on 3 servers for app usage. I want to users load data from the fastest server base on their network connection. So I need to test user’s network connection speed to my server. Is there any way to test user network speed from iPhone?
Finally, I found a solution and it works fine.
I put a small static file, for example https://www.google.com/images/icons/product/chrome-48.png, on every server, then download the file from every server and calculate time spent (Calculating Connection/Download Speed is a good way to calculate speed, thanks to @Antonio MG), then save the fastest server host with
NSUserDefaults. Before the app load data from server, replace request url host with the fastest host.When app launched or
applicationWillEnterForeground:, perform the network speed test. Now, every time at app load data is using the fastest server that just calculated.Hope this can help those who need it.