 |
|
 |
I think you should use "SELECT * FROM Win32_PerfRawData_Tcpip_NetworkInterface WHERE BytesTotalPersec > 0" instead of "SELECT * FROM Win32_NetworkAdapter WHERE NetConnectionStatus = 2".
Using PerformanceCounterCategory and doing some string comparison looks dirty.
Aurimas Neverauskas
|
|
|
|
 |
|
 |
when passing network card name to performance counter you need to check card name for invalid characters which are characters that not allowed in file name then replace it with underscore.
in above example, the performance counter code should be:
string name2 = name;
foreach (char c in System.IO.Path.GetInvalidFileNameChars())
name2 = name2.Replace(c, '_');
adapter.dlCounter = new PerformanceCounter("Network Interface", "Bytes Received/sec", name2);
adapter.ulCounter = new PerformanceCounter("Network Interface", "Bytes Sent/sec", name2);
Mohammed alaa
|
|
|
|
 |
|
 |
Hi,
I used your Monitor Network Speed on 3.5 .NET Framework.
I'm trying porting to the Compact Framework, but it seems does not go!
Have you ever developed it for CF.NET?
Best Regards
|
|
|
|
 |
|
 |
hi, i have made network monitoring based on your core. But I've add some features such as graphic and i have developed with VB.Net at all. And I want to publish it. So, I wish you give me an admit to publish it.
Please let me know
Thanks,
Yuda.
|
|
|
|
 |
|
 |
Can I get this information for network PCs?
|
|
|
|
 |
|
 |
Dear Sir,
I have tried the perfmon.exe, on almost all of the pc's at my college the "\\Network Interface\\Bytes Sent/Sec" counter is always showing 0,while it is showing proper values for the Bytes Received /Sec. While the same is working fine on my home pc, both use the same OS, i.e. winxp sp2.
and due to the counter not working, i am unable to fetch values in the app..... can you please tell me a way to enable those counters in perf mon ?
|
|
|
|
 |
|
 |
I'm not sure what may be the cause. Maybe it has something to do with device driver. Do your pc's at your college share the same hardware configuration and use the same driver (possibly a non-standard one)?
|
|
|
|
 |
|
 |
Some PC's use the same config, some uses diff. But i have no idea why onyl "Sent Bytes/Sec" is not working, rest of the counters are working fine. Any way to restart the perfmon service, and reset the counters, so that they can start, or any trouble shoot for it ?
|
|
|
|
 |
|
 |
Then might it be some software you installed? I have no idea either, and I did not find any useful information on the internet concerning this problem. Sorry
|
|
|
|
 |
|
 |
Thankyou sir, for very prompt reply.
Do you know any other way of how I can monitor the bandwidth (without the performance counters) in C#.NET 2005.
or can guide me to some links that i can refer. I have searched the .net and also codeproject, i was only able to find sample progs that used the ndis drivers, or the winpcap wrapper. I am not supposed to use them in my project at college. so if there is any other way, then it would really be apreciated.
|
|
|
|
 |
|
 |
I believe you can do it with Windows Management Instrumentation (WMI). It is quite powerful though not so easy to use as performance counters. Lots of documentation are available in MSDN. I don't know any details now since I haven't written any code with these stuff for years.
|
|
|
|
 |
|
 |
thanks m8 . I will surely try doing it using the WMI. But one question, doesn't WMI only give static info ? cause the Bandwidth will keep on changing. anyways, ill do search for these things in MSDN. thanks a lot once again
|
|
|
|
 |
|
 |
I can't guarantee that you can do it with WMI. But even with performance counters, the data I can obtain directly is packets sent/received so far. Just do some simple calculations.
|
|
|
|
 |
|
 |
I know this comes a bit late.
But i had the same problem some months ago, and i just couldnt figure out the problem, but then i had to reinstall my PC, and after that the performance counter worked fine ???. so that got me thinking, what was the diffrens between now and then, ahhh but yes it was the Pagefile i had disabled, so i went into the computer properties, and disabled the PageFile, and wupti the program <u>didnt</u> work. So my conclusion was:
Pagefile Disabled = Performance Counter Disabled
Pagefile Enabled = Performance Counter Enabled
Dont ask me how or why, but its like that on my computer... hope it helps.
modified on Sunday, December 23, 2007 11:56:53 AM
|
|
|
|
 |
|
 |
Hi
i read your article it is much easy and understandable but there is no source code of Echevil DLL i want to review code.
please send me a source code of "Echevil DLL"
Thank So much
|
|
|
|
 |
|
 |
The code from the "Download Source" link is actually the source code of the dll.
|
|
|
|
 |
|
 |
Simple, easy to understand.. Thanks
Little Improvement Day by Day
|
|
|
|
 |
|
 |
Hello,
I noticed that the memory usage keeps rising when i update my form to show the download/upload speed (with timer). At first i thought it had something to do with my program but then i looked at the memory use of the NetworkMonitorDemo and it also keeps rising.
Any way to prevent this?
|
|
|
|
 |
|
 |
Hi
Sorry i didn't reply you sooner. The earthquake in Taiwan did cause some network connectivity problems.
The memory keeps rising because network speed is sampled with performance counter in a timely fashion, and this is something I have no control over. No explicit "Dispose" of any objects can be added.
Calling garbage collector helps but nothing can be guaranteed.
|
|
|
|
 |
|
 |
Hey!
I also like this article very much. However i can only get it to find my onboard network adapter. I have a Wireless D-Link USB network card. It can't seem to find that card.
Does anyone know why?
/Lasse
|
|
|
|
 |
|
 |
As far as I can remember, normal wireless network cards work properly. If you know about the Performance monitor in windows, you may check the correspondent performance counter of your device there, and possibly make adaptions of the source code to support it.
|
|
|
|
 |
|
 |
Great article!
I was using the old Windows native PHD (Performance Data Helper) API's and it supports the wildcard (*) for network adapters. Took me a while to figure out that it doesn't work with .NET performanceCounter class (at least not with .NET 1.1)
Thanks for the tips.
|
|
|
|
 |
|
 |
As we know we cannot access Counters trough web page
winx
|
|
|
|
 |
|
 |
its very good code but we want to know about dll
and is there aney code about download speed for each program
-- modified at 4:38 Saturday 4th March, 2006
|
|
|
|
 |
|
 |
I was very pleased to find your solution.
You gave up on WMI because of non-matching adapter-names with respect to the names needed by the PerformanceCounter.InstanceName member.
I experimented a little further and (empirically) found the following:
the name needed in the PerformanceCounter.InstanceName can be derived from the description property of a Win32_NetworkAdapterConfiguration WMI Object, by replacing any round brackets ('(', ')')by square ones ('[', ']') and any slants ('/') by underscores ('_').
On my desktop running XPProSP2:
WMI: "Intel(R) PRO/1000 PM Network Connection - Packet Scheduler Miniport"
PerformanceCounter: "Intel[R] PRO_1000 PM Network Connection - Packet Scheduler Miniport"
On my laptop running Win2K:
WMI: "IBM 10/100 EtherJet CardBus Adapter"
PerformanceCounter: "IBM 10_100 EtherJet CardBus Adapter"
I believe this is consistent with your observations.
Any confirmation OR counter-evidence would be largely appreciated!
KoenV
|
|
|
|
 |