I want to get bytes sent and received in total and by each application if possible. I tried winpdh and winpdhutil but it reports the wrong number for Received in XP and doesn&#39;t seem to work for network stats in Vista:<br>
<br>[code]<br>&gt;&gt;&gt; import win32pdh<br>&gt;&gt;&gt; intf = &#39;Intel[R] PRO_100 Network Connection&#39;<br>&gt;&gt;&gt; hq = win32pdh.OpenQuery()<br>&gt;&gt;&gt; cp = win32pdh.MakeCounterPath( (None, &#39;Network Interface&#39;, intf, None, -1, &#39;Bytes Received/sec&#39;) )
<br>&gt;&gt;&gt; hc = win32pdh.AddCounter( hq, cp )<br>&gt;&gt;&gt; type,val = win32pdh.GetFormattedCounterValue( hc, win32pdh.PDH_FMT_LONG )<br><br>Traceback (most recent call last):<br>&nbsp; File &quot;&lt;pyshell#5&gt;&quot;, line 1, in &lt;module&gt;
<br>&nbsp;&nbsp;&nbsp; type,val = win32pdh.GetFormattedCounterValue( hc, win32pdh.PDH_FMT_LONG )<br>error: (-2147481645, &#39;GetFormattedCounterValue&#39;, &#39;No error message is available&#39;<br>[/code]<br>