ethernet

Read MAC Address from network adapter in .NET

冷暖自知 提交于 2019-11-27 01:36:16
I'd like to be able to read the mac address from the first active network adapter using VB.net or C# (using .NET 3.5 SP1) for a winform application Stu Mackellar Since .Net 2.0 there's been a NetworkInterface class in the System.Net.NetworkInformation namespace that will give you this information. Try this: foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces()) { if (nic.OperationalStatus == OperationalStatus.Up) { Console.WriteLine(nic.GetPhysicalAddress().ToString()); break; } } from http://www.dotnetjunkies.com/WebLog/jkirwan/archive/2004/02/10/6943.aspx Dim mc As

How can I access netstat-like Ethernet statistics from a Windows program

南楼画角 提交于 2019-11-26 16:56:22
问题 How can I access Ethernet statistics from C/C++ code like netstat -e ? Interface Statistics Received Sent Bytes 21010071 15425579 Unicast packets 95512 94166 Non-unicast packets 12510 7 Discards 0 0 Errors 0 3 Unknown protocols 0 回答1: A good place to start for network statistics would be the GetIpStatistics call in the Windows IPHelper functions. There are a couple of other approaches that are possibly more portable:- SNMP. Requires SNMP to be enabled on the computer, but can obviously be

How to reliably generate Ethernet frame errors in software?

陌路散爱 提交于 2019-11-26 16:34:53
问题 Question: I'm testing a section of cable-fault finding software, and I'd like to reliably and reproducibly generate cable faults on a cat5 cable. At the moment I'm using a meter length of untwisted cable, and wriggle the cable manually next to a power supply, but I cannot detect any faults in the application (I'm reading the Ethernet fault counters off the Ethernet ASIC.) Whether this is because no faults are generated, or because the software/hardware detection is faulty, I cannot tell. Is

Read MAC Address from network adapter in .NET

南楼画角 提交于 2019-11-26 09:42:51
问题 I\'d like to be able to read the mac address from the first active network adapter using VB.net or C# (using .NET 3.5 SP1) for a winform application 回答1: Since .Net 2.0 there's been a NetworkInterface class in the System.Net.NetworkInformation namespace that will give you this information. Try this: foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces()) { if (nic.OperationalStatus == OperationalStatus.Up) { Console.WriteLine(nic.GetPhysicalAddress().ToString()); break; }