# Determine users DL speed

**URL:** <https://forum.kirupa.com/t/determine-users-dl-speed/38625>\
**Category:** flash\
**Created:** [December 27, 2003, 1:15am UTC](https://forum.kirupa.com/t/determine-users-dl-speed/38625 "2003-12-27T01:15:02Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ratbaggy](https://avatars.discourse-cdn.com/v4/letter/r/a3d4f5/32.png) [@ratbaggy](https://forum.kirupa.com/u/ratbaggy)\
**Post date:** [December 27, 2003, 1:15am UTC](https://forum.kirupa.com/t/determine-users-dl-speed/38625/1 "2003-12-27T01:15:02Z")

</div>

Must be all the christmas festivities that have shut my brain down for today. Anyone got some code, working or suggestions for working out users download speed?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 27, 2003, 11:11am UTC](https://forum.kirupa.com/t/determine-users-dl-speed/38625/2 "2003-12-27T11:11:16Z")

</div>

just an idea : you can do it with modify a “preloading script”… u can calculate users download speed per second…  
this means that;get difference between 2 getBytesLoaded(); and calc. download speed per second…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 27, 2003, 11:27pm UTC](https://forum.kirupa.com/t/determine-users-dl-speed/38625/3 "2003-12-27T23:27:33Z")

</div>

Would be pretty cool, eh? A flash speed-test script in flash… I think it has to be some server-side scripting but I’m sure theres a way to add a tag or something that will make it download differently… It’s beyond me anyways, so phooey

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 29, 2003, 11:35am UTC](https://forum.kirupa.com/t/determine-users-dl-speed/38625/4 "2003-12-29T11:35:01Z")

</div>

i thought it again, and u can use setInterval(); for calc. DL speed per second…  
maybe this helps u more…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 29, 2003, 12:40pm UTC](https://forum.kirupa.com/t/determine-users-dl-speed/38625/5 "2003-12-29T12:40:45Z")

</div>

esxs’ first idea looks good to me. You get the amount loaded at one point, you get the amount loaded a little bit after, you substract and divide by the time elapsed. Something like this:

```auto
this.onEnterFrame = function () {
// time elapsed since the last run
var elapsed = getTimer() - this.time;
this.time = getTimer() ;
// bytes loaded since the last run
var downloaded = theClip.getBytesLoaded() - this.loaded;
this.loaded = theClip.getBytesLoaded();
// speed in bytes per millisecond
var speed = downloaded / elapsed;
}[/As]By the way, setInterval would seem very appropriate for this because you can control precisely the timing, but unfortunately, the function is not precise at all...
```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 30, 2003, 4:31pm UTC](https://forum.kirupa.com/t/determine-users-dl-speed/38625/6 "2003-12-30T16:31:36Z")

</div>

thx for the sample code Ilyas … i don’t have enough time to write it, but this is what i want to explain…  
and u r right about the setInterval…just an idea 🙂  
nice cooperate 😉
