Page 1 of 1

Remote File download and measure speed

Posted: Sun Jan 08, 2006 11:45 pm
by ITahmed
Hello All,
This is what I am trying to do but gave up

I want the user to be able to click on a button or a trigger on http://domainA.com
then DomainA web server would go and download a file (specified file) from http://domainB.com/file.zip
then it will measure the speed of the download (from DomainB to DomainA) and finally report it to the the user.

I have tried fput but got stock there.... I am a little new to these functions as to measuring speed.

I do not want to get the download from DomainA to the user, I want to make it from DomainB to DomainA (servers) as if the user is on dial up then that should be independant.

I greatly appeciate all your help.

Posted: Mon Jan 09, 2006 12:32 am
by feyd
if you want to "simulate" the download as a modem user, you don't need to transfer the file at all. Simply using the optimistic rate for a modem user (53kbps in the US) as a multiplier based on the file size, which DomainB can report far faster and more easily.

given a file of exactly 1MB (1,048,576 bytes), at optimum performance someone can expect the download to take just a bit over 2.5 minutes.

The math:
1,048,576 bytes of transfer * 8 bits per byte / (53 * 1024) actual bit rate = 154.56603773584905660377358490566 seconds

Due to various network latency and traffic issues, very very very very few people will ever see the optimistic rate, so you can add a percentage fudge factor onto the result as well to help compensate for that. Unfortunately, transferring the data between the two servers may not be realistic in the user's perspective because
  • the time taken between the two servers will only help you understand the latency between the two servers, not between the user and the server.
  • transferring the files will eat a lot of bandwidth for, as far as I can see, no real benefit.