Download Speeeeeeeds

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Gen-ik
DevNet Resident
Posts: 1059
Joined: Mon Aug 12, 2002 7:08 pm
Location: London. UK.

Download Speeeeeeeds

Post by Gen-ik »

Not sure if this should be here or in client-side so (admins) move it if you need to :)

I'm after some sort of download-speed information so that I can let a user know how long (approx) a download might take with a certain connection.

2.00 megs at 56Kbps would be => ?
7.65 megs at 512Kbps would be => ?

It doesn't have to be very accurate, and I was wondering if there was a function() class() or just some information about it that I might be able to take a look at. Another simple way of doing this might be to find out how long on average a 1 meg file takes on certain connections, and then I could do all of the working out from there.


Thanks.


PS. KBPS (kilobytes per second) as we all know tends to lie to us... so just saying that 10K would take 10 seconds on a 1Kbps connection isn't what I'm after ;)
Straterra
Forum Regular
Posts: 527
Joined: Mon Nov 24, 2003 8:46 am
Location: Indianapolis, Indiana
Contact:

Post by Straterra »

Hm....couldn't you ping the user and get a small idea of their speed, and take that data and perhaps display information?
Gen-ik
DevNet Resident
Posts: 1059
Joined: Mon Aug 12, 2002 7:08 pm
Location: London. UK.

Post by Gen-ik »

Straterra wrote:Hm....couldn't you ping the user and get a small idea of their speed, and take that data and perhaps display information?
If you have an example that would be better as I haven't even looked at PHP pinging before :?

Since I posted this topic though I have (from various sources) worked out a rough guide for download times of a 1meg file.

Code: Select all

Connection			Filesize		Time


		56K Modem			1.00MB			(155.108 seconds)
		128K ISDN			1.00MB			(064.086 seconds)
		256K Cable			1.00MB			(031.888 seconds)
		512K DSL/Cable		1.00MB			(016.408 seconds)
		1MB DSL/Cable		1.00MB			(008.049 seconds)
		T-1					1.00MB			(005.263 seconds)
		2MB DSL/Cable		1.00MB			(004.334 seconds)
If there is a more accurate way of doing it though them I all ears.
Straterra
Forum Regular
Posts: 527
Joined: Mon Nov 24, 2003 8:46 am
Location: Indianapolis, Indiana
Contact:

Post by Straterra »

I haven't pinged before either, but if you are on a Linux system, can't you uses PHP to exec the ping command?
User avatar
dull1554
Forum Regular
Posts: 680
Joined: Sat Nov 22, 2003 11:26 am
Location: 42:21:35.359N, 76:02:20.688W

Post by dull1554 »

if your users have to register before they can download, then you should ask them what their conection speed is, then when they go to download a file, reference a database for aprox. DL time, and multiply it by the size of the file (in mb), as far as i can tell by looking at the php manual, there is no pre made php function to ping a person's BOX
Gen-ik
DevNet Resident
Posts: 1059
Joined: Mon Aug 12, 2002 7:08 pm
Location: London. UK.

Post by Gen-ik »

dull1554 wrote:if your users have to register before they can download, then you should ask them what their conection speed is, then when they go to download a file, reference a database for aprox. DL time, and multiply it by the size of the file (in mb), as far as i can tell by looking at the php manual, there is no pre made php function to ping a person's BOX
Yeah I've got things set-up to do just that at the moment... it was just some download speeds (on various connections) that I was after and I think I've sorted that too (see above).

I'm using it just to give the user an idea of how long it will take to download their selection of MP3 files on their (selected) connection speed.

Thanks anyway mate :)
Straterra
Forum Regular
Posts: 527
Joined: Mon Nov 24, 2003 8:46 am
Location: Indianapolis, Indiana
Contact:

Post by Straterra »

If you haven't already, search this forum for pinging people. I could have sworn I remember reading something about someone finding a way to ping though PHP on a *nix system...
User avatar
dull1554
Forum Regular
Posts: 680
Joined: Sat Nov 22, 2003 11:26 am
Location: 42:21:35.359N, 76:02:20.688W

Post by dull1554 »

w/e
basdog22
Forum Contributor
Posts: 158
Joined: Sun Nov 30, 2003 3:03 pm
Location: Greece

Post by basdog22 »

i think you can also find it like that:

56k ---> 56000/8 == 7kb /sec

128k ---> 13kb/sec

etc...

then:

1mb /7kb ---> 142 seconds on 56k
fastfingertips
Forum Contributor
Posts: 242
Joined: Sun Dec 28, 2003 1:40 am
Contact:

Post by fastfingertips »

basdoq a little mathematic please :P
1Mb= 1024/7=146 seconds :D.

Anyway your speed is the ideal one. If you need to display a real time is possible (using pings) but i think is very hard (ps use flash script for that :D)
basdog22
Forum Contributor
Posts: 158
Joined: Sun Nov 30, 2003 3:03 pm
Location: Greece

Post by basdog22 »

BTW

128k != 13kb

128k != 14kb

:P :P :P :P :P
Post Reply