|
|
|
Step-By-Step Example
- Create a standard exe project - Add one timer and one listbox control on the form1 - Add the following code in form1 |
Click here to copy the following block | Private Type MIB_TCPSTATS dwRtoAlgorithm As Long dwRtoMin As Long dwRtoMax As Long dwMaxConn As Long dwActiveOpens As Long dwPassiveOpens As Long dwAttemptFails As Long dwEstabResets As Long dwCurrEstab As Long dwInSegs As Long dwOutSegs As Long dwRetransSegs As Long dwInErrs As Long dwOutRsts As Long dwNumConns As Long End Type
Private Declare Function GetTcpStatistics Lib "iphlpapi.dll" ( _ pStats As MIB_TCPSTATS) As Long
Private Sub Form_Load() Timer1.Enabled = True Timer1.Interval = 1000 End Sub
Private Sub Timer1_Timer() UpdateStats End Sub
Private Sub UpdateStats() Dim arrInfo(14) As String Dim arrLablels(14) As String * 30 Dim tStats As MIB_TCPSTATS Dim lRetValue As Long Dim blnIsSent As Boolean Dim blnIsRecv As Boolean
List1.Clear
lRetValue = GetTcpStatistics(tStats)
arrLablels(0) = "Timeout algorithm" arrLablels(1) = "Minimum timeout" arrLablels(2) = "Maximum timeout" arrLablels(3) = "Maximum connections" arrLablels(4) = "Active opens" arrLablels(5) = "Passive opens" arrLablels(6) = "Failed attempts" arrLablels(7) = "Establised connections reset" arrLablels(8) = "Established connections" arrLablels(9) = "Segments received" arrLablels(10) = "Segment sent" arrLablels(11) = "Segments retransmitted" arrLablels(12) = "Incoming errors" arrLablels(13) = "Outgoing resets" arrLablels(14) = "Cumulative connections"
With tStats arrInfo(0) = .dwRtoAlgorithm arrInfo(1) = .dwRtoMin arrInfo(2) = .dwRtoMax arrInfo(3) = .dwMaxConn arrInfo(4) = .dwActiveOpens arrInfo(5) = .dwPassiveOpens arrInfo(6) = .dwAttemptFails arrInfo(7) = .dwEstabResets arrInfo(8) = .dwCurrEstab arrInfo(9) = .dwInSegs arrInfo(10) = .dwOutSegs arrInfo(11) = .dwRetransSegs arrInfo(12) = .dwInErrs arrInfo(13) = .dwOutRsts arrInfo(14) = .dwNumConns End With
Me.Caption = "Received [" & tStats.dwInSegs & "] " & "Sent [" & tStats.dwOutSegs & "]"
For i = 0 To 14 List1.AddItem arrLablels(i) & " : " & arrInfo(i) Next End Sub |
|
|
|
Submitted By :
Nayan Patel
(Member Since : 5/26/2004 12:23:06 PM)
|
|
|
Job Description :
He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting. |
View all (893) submissions by this author
(Birth Date : 7/14/1981 ) |
|
|