forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Download Speed

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
Rubes_sw
Valued Contributor
Valued Contributor


Joined: 11 Jun 2001
Posts: 625
Location: Northern Ireland

PostPosted: Mon Oct 27, 2003 7:24 pm    Post subject: Download Speed Reply with quote

Anyone got any scripts lying around that can:

Show the speed in which a file is being downloaded.

eg. using vdsipp.dll to download the file, retreiving the transfer bytes,

How to you calculate the KB/Sec using the transfer bytes and time?

Anyone any scripts, code etc

Thanks

Nathan
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Vic D'Elfant
Past Contributor
Past Contributor


Joined: 26 Jun 2002
Posts: 673
Location: The Netherlands

PostPosted: Tue Oct 28, 2003 10:33 am    Post subject: Reply with quote

Hmmm... how about his one:

Code:

#define function, internet

%%TransferredBytes_1 = @internet(http, transferredbytes, 1)
wait 1
%%TransferredBytes_2 = @internet(http, transferredbytes, 1)

%%TransferredBytes = @diff(%%TransferredBytes_2, %%TransferredBytes_1)
#--- %%TransferredBytes now holds the number of bytes tranferred in one second
%%Speed = @fdiv(%%TransferredBytes, 1000)
info Your download speed is %%Speed Kb/Sec


Regards Smile,
Vic

_________________
phpBB Development Team


Last edited by Vic D'Elfant on Tue Oct 28, 2003 6:04 pm; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
Skit3000
Admin Team


Joined: 11 May 2002
Posts: 2166
Location: The Netherlands

PostPosted: Tue Oct 28, 2003 2:02 pm    Post subject: Reply with quote

This way you can calculate the average speed from the beginning of the download:

Code:
#define function,internet

rem Calculate the time in seconds...
%%Starttime = @sum(@prod(@datetime(hh),3600),@prod(@datetime(nn),60),@datetime(ss))

rem Just wait a while...
wait 1

rem Calculate the time in seconds again...
%%Endtime = @sum(@prod(@datetime(hh),3600),@prod(@datetime(nn),60),@datetime(ss))

rem To make kB from bytes, you should divide it with 1024...
%%TransferredKiloBytes = @div(@internet(http, transferredbytes, 1),1024)

rem And the speed is the number of kB / the total time...
%%Speed = @fdiv(%%TransferredKiloBytes,@diff(%%Endtime,%%Starttime))

info The speed is around %%Speed kB/sec...

_________________
[ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial!
Back to top
View user's profile Send private message
Protected
Valued Contributor
Valued Contributor


Joined: 02 Jan 2001
Posts: 228
Location: Portugal

PostPosted: Tue Oct 28, 2003 8:41 pm    Post subject: Reply with quote

Notice in Skit's example vic... a Kb has 1024 bytes =) Its important
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Vic D'Elfant
Past Contributor
Past Contributor


Joined: 26 Jun 2002
Posts: 673
Location: The Netherlands

PostPosted: Wed Oct 29, 2003 8:21 am    Post subject: Reply with quote

Oops Embarassed

I made the example in about two minutes and I didn't thought about that one. I should have known Wink

Regards,
Vic

_________________
phpBB Development Team
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group