6

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?

Community
  • 1
  • 1
fannheyward
  • 18,599
  • 12
  • 71
  • 109
  • Check the answer here: http://stackoverflow.com/questions/370641/calculating-connection-download-speed I hope it helps, I tried personally. – Antonio MG Apr 25 '12 at 09:28

1 Answers1

3

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.

Community
  • 1
  • 1
fannheyward
  • 18,599
  • 12
  • 71
  • 109