Downloads:
Features:
- Show all networking devices information
- Network monitor
C# Source Code:
- Main.cs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Windows.Forms; using System.Net; using System.Net.NetworkInformation; using System.Text.RegularExpressions; using System.Globalization; using System.Linq; namespace NetworkMonitor { public partial class Main : Form { #region Bandwidth Calculator NetworkInterface slectedNic; /// Bandwidth Calculator UnicastIPAddressInformation uniCastIPInfo; /// Bandwidth Calculator #endregion public Main() { InitializeComponent(); } #region Main Form Loading & Closing private void Main_Load(object sender, EventArgs e) { #region Bandwidth Calculator try { IEnumerable<NetworkInterface> nemo = NetworkInterface.GetAllNetworkInterfaces().Where(network => network.NetworkInterfaceType == NetworkInterfaceType.Wireless80211); comboBox.DisplayMember = "Description"; comboBox.ValueMember = "Id"; foreach (NetworkInterface item in nemo) { comboBox.Items.Add(item); } } catch (Exception EX) { MessageBox.Show("Error !" + EX.Message.ToString()); } #endregion } private void Main_FormClosing(object sender, FormClosingEventArgs e) { } #endregion #region BandwidthCalculator private void comboBox_SelectedIndexChanged(object sender, EventArgs e) { try { if (comboBox.SelectedItem is NetworkInterface) { slectedNic = comboBox.SelectedItem as NetworkInterface; uniCastIPInfo = null; ///Populating IPv4 address if (slectedNic != null && slectedNic.GetIPProperties().UnicastAddresses != null) { UnicastIPAddressInformationCollection ipInfo = slectedNic.GetIPProperties().UnicastAddresses; foreach (UnicastIPAddressInformation item in ipInfo) { if (item.Address.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork) { txtIP.Text = item.Address.ToString(); uniCastIPInfo = item; break; } } } BandwidthCalculator(uniCastIPInfo, slectedNic); WirelessUpdate.Enabled = true; } } catch (Exception ex) { } } public void BandwidthCalculator(UnicastIPAddressInformation ipInfo, NetworkInterface SEN) { try { if (SEN == null) return; txtWireless.Text = SEN.NetworkInterfaceType.ToString(); txtOS.Text = SEN.OperationalStatus.ToString(); IPv4InterfaceStatistics interfaceData = SEN.GetIPv4Statistics(); int bytesRecivedSpeedValue = (int)(interfaceData.BytesReceived - double.Parse(txtBytes.Text)) / 1024; txtBytes.Text = interfaceData.BytesReceived.ToString(); txtSpeed.Text = bytesRecivedSpeedValue.ToString() + " KB/s"; if (ipInfo != null) { TimeSpan addressLifeTime = TimeSpan.FromSeconds(ipInfo.AddressValidLifetime); txtAVL.Text = string.Format("{0:D2}H:{1:D2}M:{2:D2}S:{3:D3}MS", addressLifeTime.Hours, addressLifeTime.Minutes, addressLifeTime.Seconds, addressLifeTime.Milliseconds); } } catch (Exception ex) { } } private void WirelessUpdate_Tick(object sender, EventArgs e) { BandwidthCalculator(uniCastIPInfo, slectedNic); } #endregion } } |
Screenshots:
Similar Apps:
- Unknown
Contact: