当前位置: 动力学知识库 > 问答 > 编程问答 >

javascript - testing client bandwidth with asp.net mvc

问题描述:

I want calculating client bandwidth in asp.net mvc and already I used JavaScript

<script language="javascript" type="text/javascript">

time = new Date();

time1 = time.getTime();

</script>

<!-- Dummy Text to measure transfer speed -->

<script language="javascript" type="text/javascript">

time = new Date();

time2 = time.getTime();

ttime = time2 - time1;

if (ttime == 0)

ttime = .1;

ttime = ttime / 1000; //thousand mili seconds

kbps = 45 / ttime;

kbps = kbps * 8; // multiply by 8 to make kiloBITS instead of kiloBYTES

kbps = Math.round (kbps);

document.getElementById("lblBandwidth").innerHTML=kbps + " kbps";

</script>

you can see this on http://www.whoismaster.ir/Home/BandwidthMeter

but this is not accurate

how can used accurate code for this?

I like used asp.net mvc with c# for exactly bandwidth

分享给朋友:
您可能感兴趣的文章:
随机阅读: