Results 1 to 2 of 2

Thread: How to calculate total internet traffic ?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 2007
    Posts
    76

    How to calculate total internet traffic ?

    Hi,
    How much data was delivered to my computer from the Internet.
    Maybe I should to use some API-windows 10 ?
    I have used PerformanceCounterCategory(".NET CLR Networking 4.0.0.0") but it shows zeros.

  2. #2

    Thread Starter
    Lively Member
    Join Date
    Dec 2007
    Posts
    76

    Re: How to calculate total internet traffic ?

    I copied it from the Microsoft site and changed it a bit.
    At all events, it works as I needed.
    Code:
                NetworkInterface[] adapters = NetworkInterface.GetAllNetworkInterfaces();
                foreach (NetworkInterface adapter in adapters)
                {
                    bytesIn_Session = adapter.GetIPStatistics().BytesReceived;
                    bytesOutSession = adapter.GetIPStatistics().BytesSent;
    
                    if((bytesIn_Session>0) || (bytesOutSession > 0)) {
    
                        mbOutSession = bytesOutSession / _1MB;
                        mbIn_Session = bytesIn_Session / _1MB;
    
                        IPInterfaceProperties properties = adapter.GetIPProperties();
    
                        listBox2.Items.Add(adapter.Description);
                        listBox2.Items.Add("  Dynamically configured DNS ..... " + properties.IsDynamicDnsEnabled);
                        listBox2.Items.Add("  Received..... " + mbIn_Session);
                        listBox2.Items.Add("  Sent......... " + mbOutSession);
    
                   }//if
                }//foreach

Tags for this Thread

Posting Permissions

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



Click Here to Expand Forum to Full Width