NetworkInterface: GetIPv4Statistics : NetworkInterface « Network « C# / C Sharp






NetworkInterface: GetIPv4Statistics

 
using System;
using System.Net.NetworkInformation;

class MainClass {
    static void Main() {
        if (NetworkInterface.GetIsNetworkAvailable()) {
            NetworkInterface[] interfaces = NetworkInterface.GetAllNetworkInterfaces();
            foreach (NetworkInterface ni in interfaces) {
                Console.WriteLine("    Bytes Sent: {0}", ni.GetIPv4Statistics().BytesSent);
            }
        } else {
            Console.WriteLine("No network available.");
        }
    }
}

 








Related examples in the same category

1.NetworkInterface: GetIPProperties
2.NetworkInterface: GetPhysicalAddress
3.NetworkInterface: OperationalStatus
4.NetworkInterface: NetworkAvailabilityChanged event
5.NetworkInterface:NetworkAddressChanged event
6.NetworkInterface: GetAllNetworkInterfaces
7.NetworkInterface: Name
8.NetworkInterface: Description
9.NetworkInterface: Id
10.NetworkInterface: NetworkInterfaceType
11.NetworkInterface: Speed