1
我試圖監控我的互聯網連接的流量,即給定時間的平均速度,以獲得平均速度。我試過這個代碼,但它不工作。我哪裏出錯了?帶寬監控系統
Function bwmonitor()
Dim pc As New PerformanceCounterCategory("Network Interface")
Dim instance As String = pc.GetInstanceNames(0)
Dim bs As New PerformanceCounter("Network Interface", "Bytes Sent/sec", instance)
Dim br As New PerformanceCounter("Network Interface", "Bytes Received/Sec", instance)
Dim k As Integer = 0
Do
k = k + 1
Dim kbsent As Integer = bs.NextValue()/1024
Dim kbRecieved As Integer = br.NextValue/1024
TextBox10.Text = kbsent
TextBox11.Text = kbRecieved
Threading.Thread.Sleep(1000)
Loop Until k = 10
Return 0
End Function
我已經調用函數,但文本框只返回零。
thanx,我仍然有一個挑戰,我仍然想與我的WindowsApplication集成它。就像分配給變量一樣,這將幫助我顯示正在發送或接收的平均帶寬。 – 2013-04-28 13:00:13
另外,我正在使用接口9 – 2013-04-28 13:01:08
我已經解決了GUI部分檢查這個問題[Windows控制檯帶寬監視器](http://stackoverflow.com/questions/16264927/windows-console-bandwidth-monitoring-system) – 2013-04-28 16:22:10