What do you mean by "Bandwidth"?

The total bandwidth of the interfaces on this computer is 154Mb/s (100Mb/s wired + 54Mb/s wireless).

The current speed can only be calculated as an average:
<delta data transferred> / <elapsed time>

Let us know which you want to display, bandwidth or speed.



edit:

If you are looking for a script to display the current (average) speed, this should work for you.

Code:
on *:START:bw.check
alias bwcheck {
  .timerbw 1 5 bwcheck

  var %r, %c = 0, %cc = $numtok($dll($scriptdir $+ moo.dll,interfaceinfo,_),35)
  if (!$hget(bw)) hmake bw 1
  else hdel -w bw t.*

  while (%c < %cc) {
    inc %c

    %r = $gettok($dll($scriptdir $+ moo.dll,interfaceinfo,_),%c,35)
    %r = $regex(d.i,%r,/([\d.]+)MB In/i) $regex(d.o,%r,/([\d.]+)MB Out/i)

    if (!$hget(bw,first)) {
      hadd -m bw $+(I.,%c) $regml(d.i,1)
      hadd -m bw $+(O.,%c) $regml(d.o,1)
    }

    hadd -m bw t.i $calc($hget(bw,t.i) + ($regml(d.i,1) - $hget(bw,$+(I.,%c))))
    hadd -m bw t.o $calc($hget(bw,t.o) + ($regml(d.o,1) - $hget(bw,$+(O.,%c))))

    hadd -m bw $+(I.,%c) $regml(d.i,1)
    hadd -m bw $+(O.,%c) $regml(d.o,1)
  }

  var %time = $calc($ticks - $hget(bw,time))
  hadd -m bw time $ticks
  hadd -m bw first 1

  ;returns <IN> <OUT> <unit>
  return $round($calc($hget(bw,t.i) * 10^6 / %time),3) $round($calc($hget(bw,t.o) * 10^6 / %time),3) kb/s
}


However, it requires the use of a dll (moo.dll). If anyone can present COM code that will retrieve the same NIC stats as moo.dll, the dll can be eliminated. The data that moo.dll returns looks like this:

Code:
1 (D-Link AirPlus G DWL-G122 Wireless USB Adapter(rev.B) - Packet Scheduler Miniport (11Mb/s) 0.07MB In, 0.01MB Out)
2(Realtek RTL8139 Family PCI Fast Ethernet NIC - Packet Scheduler Miniport (100Mb/s) 3429.34MB In, 714.39MB Out)


-genius_at_work

Last edited by genius_at_work; 05/05/07 04:18 AM.