dcsimg
Results 1 to 3 of 3
  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2015
    Posts
    1,923

    [VB6] Tcp Extended Stats API / GetPerTcpConnectionEStats

    Here's a Demo of the Tcp Extended Stats APIs, translated from MSDN.
    GetPerTcpConnectionEStats --> https://msdn.microsoft.com/en-us/lib...(v=vs.85).aspx

    Name:  TcpEStats.jpg
Views: 110
Size:  40.7 KB
    Attached Files Attached Files
    Last edited by DEXWERX; May 7th, 2018 at 11:11 AM.
    Imagine what it would be like to set breakpoints in, or step through subclassing code;
    and then being able to hit stop/end/debug or continue, without crashing the IDE.

    VB6.tlb | Bulletproof Subclassing in the IDE (no thunks/assembly/DEP issues)

  2. #2
    Junior Member
    Join Date
    Jun 2013
    Posts
    20

    Re: [VB6] Tcp Extended Stats API / GetPerTcpConnectionEStats

    Thank you. I will see what I can do with this. Trying to get all traffic for all connections along with RTT

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2015
    Posts
    1,923

    Re: [VB6] Tcp Extended Stats API / GetPerTcpConnectionEStats

    Small bug with the ToggleEStat() function. My refactoring/simplification left out a couple flags. I'll post an update later on.

    for now here's the updated function.
    Code:
    '
    ' Enable or disable the supplied EStat type on a TCP connection.
    '
    Sub ToggleEStat(ByVal Row As Long, _
                    ByVal EStatsType As TCP_ESTATS_TYPE, _
                    ByVal Enable As Boolean, _
                    ByVal V6 As Boolean _
                    )
        Dim Status As Long
        Dim Size As Long
        Dim Rw As Long
        Dim EnableRw As Byte ' BOOLEAN
        Dim BandwidthRw As TCP_ESTATS_BANDWIDTH_RW_v0
        
        If Enable Then EnableRw = TRUE_ ' TRUE == 1 == TcpBoolOptEnabled
        
        Select Case EStatsType
            Case TcpConnectionEStatsBandwidth
                BandwidthRw.EnableCollectionInbound = EnableRw
                BandwidthRw.EnableCollectionOutbound = EnableRw
                Rw = VarPtr(BandwidthRw)
                Size = LenB(BandwidthRw)
            Case TcpConnectionEStatsSynOpts To TcpConnectionEStatsFineRtt
                Rw = VarPtr(EnableRw)
                Size = LenB(EnableRw)
            Case Else
                Exit Sub
        End Select
    
        If V6 Then
            Status = SetPerTcp6ConnectionEStats(ByVal Row, EStatsType, _
                                                ByVal Rw, 0, Size, 0)
        Else
            Status = SetPerTcpConnectionEStats(ByVal Row, EStatsType, _
                                               ByVal Rw, 0, Size, 0)
        End If
    
        If Status <> NO_ERROR Then
            wprintf "SetPerTcp{2}ConnectionEStats {0} {1} failed. {3}", _
                    EStatsTypeNames(EStatsType), IIf(Enable, "enabled", "disabled"), _
                    IIf(V6, "6", ""), DLLError(Status, "iphlpapi")
        End If
    End Sub
    Last edited by DEXWERX; May 7th, 2018 at 08:43 AM.
    Imagine what it would be like to set breakpoints in, or step through subclassing code;
    and then being able to hit stop/end/debug or continue, without crashing the IDE.

    VB6.tlb | Bulletproof Subclassing in the IDE (no thunks/assembly/DEP issues)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width


×
We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.