Determine the speed on internet programmatically

后端 未结 3 1788
眼角桃花
眼角桃花 2020-12-01 16:54

I know with reachability you can check if you are connected to the internet. But is there a way to determine the speed of that connection? I am trying to calculate upload sp

3条回答
  •  南方客
    南方客 (楼主)
    2020-12-01 17:58

    If you use NSURLConnection to grab a large file (say, 1 MB or greater), you can use a delegate to track intermediate download progress.

    Specifically: If you measure the difference in bytes downloaded and the difference in time between calls to the delegate, then you can calculate the ongoing speed in bytes per second (or other time unit).

提交回复
热议问题