1

how to calculate upload speed as well as download speed separately.

How to determine the speed on internet programmatically? like this enter image description here

jscs
  • 63,694
  • 13
  • 151
  • 195

1 Answers1

1

First capture start time of download or upload task, I mean when you start download or upload capture or store your current system time something like,

   NSTimeInterval startTime = [NSDate timeIntervalSinceReferenceDate];

Then you can check your download or upload speed like,

   double yourSpeed = bytesTransferred / ([NSDate timeIntervalSinceReferenceDate] - startTime);

bytesTransferred, you can got from delegate methods of your NSURlSession or NSUrlConnection whatever you are using!!!

Ketan Parmar
  • 27,092
  • 9
  • 50
  • 75