Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Net.NetworkInformation;
- namespace ConsoleApplication1
- {
- class Program
- {
- static void Main(string[] args)
- {
- double Incoming = 0;
- double Outgoing = 0;
- double TotalInterface;
- string SelectedInterface = "Local Area Connection";
- NetworkInterface netInt = NetworkInterface.GetAllNetworkInterfaces().Single(n => n.Name.Equals(SelectedInterface));
- for (; ; )
- {
- IPv4InterfaceStatistics ip4Stat = netInt.GetIPv4Statistics();
- Incoming += (ip4Stat.BytesReceived - Incoming);
- Outgoing += (ip4Stat.BytesSent - Outgoing);
- TotalInterface = Incoming + Outgoing;
- string Shutdown = ((TotalInterface > 40000D) ? "YES" : "NO");
- string output = string.Format("Shutdown: {0} | {1} KB/s", Shutdown, TotalInterface.ToString());
- Console.WriteLine(output);
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment