I am attempting to create a speed test server that can be used across a LAN with speeds ranging from 10 Mbps (Wi-Fi) up to 10 Gbps (Servers in our datacenter) and can be accessed from Mac, Windows, iOS, and Android.
I'd like to test speed by downloading as much random data as possible over x seconds and calculating the speed based on that.
How can I do this using PHP and JavaScript? (I can use any server-side code if there is a far easier way in another language, I just prefer PHP for it's portability.)
I added a comment about previous solutions I've tried, I'll include there here to make it more clear.
I have attempted 4 other ways to do this previously:
1) speedtest.net's Mini Speed Test Server.
Problem - Requires Flash. Doesn't work with mobile devices.
2) WiseLoop JavaScript Bandwidth Tester
Problem - Not very accurate. More complicated than I need.
3) Generate x files of y MBs random data each in PHP, download the files sequentially, then calculate the average.
Problem - If I choose too small of a file then fast connections aren't as accurate. If I choose large files then slow connections take too long.
4) Generate 1 large file, download it, and calculate speed.
Problem - Takes too long on slow connections. Or has to be too small to effectively test fast connections.