mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Mar 2004
Posts: 175
Vogon poet
OP Offline
Vogon poet
Joined: Mar 2004
Posts: 175
I'm a bit new to sockets. I'm making a dialog with an MDX.dll supported progress bar for tracking the progress of a download. The information I want to retrieve is the file size, downloaded size, and download speed. However, I do not know how. $Sock($Sockname).rcvd = Downloaded size, correct?


- Relinsquish
Joined: Aug 2003
Posts: 314
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Aug 2003
Posts: 314
Before the file is sent the server should sent you a Content-Length line contained within the header telling you filesize in bytes of the requested file. So you can store this value somewhere, perhaps use /sockmark to assign it to the socket itself. Then as you said $sock().rcvd will give you the number of bytes received, and $sock().to the number of seconds the socket has been open. You can then calculate the ratio of bytes received against total bytes with $calc($sock(name).rcvd / $sock(name).mark) to know how the progress of the download. For download speed you could use $calc($sock(name).rcvd / $sock(name).to / 1000) for kb/s and $duration($calc(($sock(name).mark - $sock(name).rcvd) * $sock(name).to / $sock(name).rcvd)) for expected time remaining

Joined: Mar 2004
Posts: 175
Vogon poet
OP Offline
Vogon poet
Joined: Mar 2004
Posts: 175
Thanks a lot.


- Relinsquish

Link Copied to Clipboard