I'd like to know if there is any way to access info like number of discarded packets from within .NET framework. I am aware of Win32_PerRawData and Ip Helper API. Thanks in advance
相关问题
- Generic Generics in Managed C++
- How to Debug/Register a Permanent WMI Event Which
- 'System.Threading.ThreadAbortException' in
- Faster loop: foreach vs some (performance of jsper
- Bulk update SQL Server C#
This is lazy and cheating here but....I know I will get flamed for this...Would you not consider using a process to execute
netstat -e n
where n is the interval in number of seconds. If you are talking about a Winforms/WPF, using theSystem.Diagnostics.Process
class to shell out to a hidden window with the output redirected to an input stream in which you can parse the discarded packets?Edit: Here's a suggested code sample
Simple, hidden window....
Hope this helps, Best regards, Tom.
Your can use the PerformanceCounter class. Run Perfmon.exe to find out what's available on your machine. You should have Network Interface + Packets Received Discarded for each of your network adapters for example.