Hi,

i am new to VB and am working on a project to develop simple tool that will be able to monitor the traffic/bandwidth of LAN topology.

For VB i just know the basics, like making forms and others.
Please, if possible give me guidline and also workable code that i can be able to work with. i have tried looking for the necessary information online but i dont quite get what i need.

i need this fast. thanx in advance

Dani AI

Generated

A practical, low‑risk plan for : is correct that a full-featured LAN monitor can get complex, so break the work into small, testable steps. Decide first whether the tool should measure a single Windows host, every host on the LAN, or the router/switch interfaces. Host polling is the fastest path for a quick proof‑of‑concept; router/switch polling (SNMP) or packet capture (WinPcap/Npcap) are the next steps when per‑flow detail or aggregated counters are required.

A simple, reliable starter approach in VB.NET is to poll the OS interface counters and compute the delta over a fixed interval. This gives an accurate link throughput estimate per interface without kernel drivers. The example below shows the basic loop: read BytesReceived+BytesSent, wait, read again, compute bits/sec and convert to Mbps.

Imports System.Net.NetworkInformation
Imports System.Threading

Module SimpleMonitor
    Sub Main()
        Dim intervalMs As Integer = 1000
        Dim prevTotals As New Dictionary(Of String, Long)

        For Each ni As NetworkInterface In NetworkInterface.GetAllNetworkInterfaces()
            Dim s = ni.GetIPv4Statistics()
            prevTotals(ni.Id) = s.BytesReceived + s.BytesSent
        Next

        While True
            Thread.Sleep(intervalMs)
            For Each ni As NetworkInterface In NetworkInterface.GetAllNetworkInterfaces()
                Dim s = ni.GetIPv4Statistics()
                Dim nowTotal As Long = s.BytesReceived + s.BytesSent
                Dim prevTotal As Long = If(prevTotals.ContainsKey(ni.Id), prevTotals(ni.Id), nowTotal)
                Dim deltaBytes As Long = nowTotal - prevTotal
                Dim bitsPerSec As Double = (deltaBytes * 8.0) / (intervalMs / 1000.0)
                Dim mbps As Double = bitsPerSec / 1000000.0
                Console.WriteLine("{0} : {1:F2} Mbps", ni.Name, mbps)
                prevTotals(ni.Id) = nowTotal
            Next
        End While
    End Sub
End Module

Notes and next steps: for router/switch totals use SNMP counters (MIB‑II ifInOctets/ifOutOctets or 64‑bit ifHC* counters to avoid wrap); for per‑flow visibility use Npcap/SharpPcap but that requires driver install and elevated rights. Watch sampling interval (short intervals are noisy), counter wrap on older 32‑bit counters, NIC offload effects, and whether the target platform is VB6 (then use native libraries or COM wrappers instead of System.Net). Useful references: NetworkInterface.GetAllNetworkInterfaces and Npcap.

Ro,
Please gauge your task yourself. The complex algorithm
which you have to translate into workable codes in VB.
Of course, there are off-the-shelf objects and methodes
in VB. But to use those things my openion is that you
have to have above medium level programming ability in VB. From
your posting, I could understand that you have just
begun only.

See, people have a notion that the throughput or the
bandwidth of a given medium can be measured as the time
taken between two systems to transfer a particular file
of known quantum (KBS MEGAS) through it. That is only
basic. There are so many other bottlenecks that are to be
hard coded into your program. (eg. even the type of the
ethernet card got a performance grade). I think for this
purpose we have to run a tutorial for you. And this is
against the very purpose of this forum. Please read the
anouncement of Queen Dani in the upper pannel.

First try to write suedo code for you algorithm and try
to translate it into VB. We are here to help you by
clearing your doubts.

Happy Programming

regards
AV Manoharan

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.