Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

WMI - howto get TX and RX packet count

430 views
Skip to first unread message

Frank

unread,
Mar 11, 2006, 7:54:26 PM3/11/06
to
Is there a way to obtain the total number of transmitted (TX) and received
(RX) packets from a particular network interface in Windows
NT/2000/2003/XP/Vista using WMI? If this is not possible with WMI and is
possible using another method such as API call, please let me know.

Thank you,

Frank


newbie

unread,
Mar 12, 2006, 11:53:24 AM3/12/06
to
yes you can with wmi.
but it is a counter ... ( uint32 => +- 4GB )


"Frank" <b...@nospam.nospam> schreef in bericht
news:eCAYI%23WRGH...@TK2MSFTNGP10.phx.gbl...

Frank

unread,
Mar 12, 2006, 1:00:36 PM3/12/06
to
Thank you for your reply. Can you be a little more specific as to which
couter you are referring to in WMI? Is the counter below the network
interface or part of Perfmon counters?

Thanks,

Frank

"newbie" <as...@aswin.be> wrote in message
news:441451fc$0$14132$ba62...@news.skynet.be...

Gary Chang[MSFT]

unread,
Mar 14, 2006, 3:17:47 AM3/14/06
to
Hi Frank,

Have you checked the Win32_PerfFormattedData_Tcpip_NetworkInterface class?

There has some related properties to your question:

PacketsReceivedPerSec;
PacketsSentPerSec;
..

I suggest you can refer to the following Platform SDK documentation for the
details:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/
win32_perfformatteddata_tcpip_networkinterface.asp


Thanks!

Best regards,

Gary Chang
Microsoft Community Support
======================================================
PLEASE NOTE the newsgroup SECURE CODE and PASSWORD will be updated at 9:00
AM PST, February 14, 2006. Please complete a re-registration process by
entering the secure code mmpng06 when prompted. Once you have entered the
secure code mmpng06, you will be able to update your profile and access the
partner newsgroups.
======================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from this issue.
======================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
======================================================

newbie

unread,
Mar 14, 2006, 10:22:15 AM3/14/06
to
I have searched for a long time for it...
I have some projects here who give you what you want.
send me a mail...

"Frank" <b...@nospam.nospam> schreef in bericht

news:OGE7g7fR...@TK2MSFTNGP11.phx.gbl...

Frank

unread,
Mar 14, 2006, 1:49:28 PM3/14/06
to
Gary,

I'm looking to capture the "total" number of packets "sent" and "received"
by the interface/adapter (not looking for per second counters). In Windows
2000/2003/XP if you open the properties of the network interface there is a
section called "activity" and shows the number of packets sent/received. I'm
looking to capture this information, i.e. cumulative total packets.

Where is the information for the adapter properties being pulled from?

Thank you,

Frank

""Gary Chang[MSFT]"" <v-ga...@online.microsoft.com> wrote in message
news:dmwpP$zRGHA...@TK2MSFTNGXA03.phx.gbl...

Gary Chang[MSFT]

unread,
Mar 15, 2006, 1:52:55 AM3/15/06
to
Hi Frank,

>Where is the information for the adapter properties being pulled from?

I am afraid I don't find a WMI class which provide the TX and RX packet
count you wants. But I know that data could be easily retrieved via the
networking API. The MIB_IFROW structure's member--dwInUcastPkts and
dwOutUcastPkts are the numbers of packets received and sent by a particular
interface:

MIB_IFROW
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/mib/mib/mib
_ifrow.asp

There is a sample project in the Codeguru website which queries the
MIB_IFROW structure to get the MAC/NIC statistical information:
http://www.codeguru.com/cpp/i-n/network/networkinformation/article.php/c5437
/

To use that sample, you can add the following code snippet just after the
follwoing code snippet:

//Print out physical address ...line 78
printf( "%s\n", &macStr[0] );

//Insert code here:
printf( "Received Packets: %d\n", details.dwInUcastPkts );
printf( "Sent ackets: %d\n", details.dwOutUcastPkts );
..

(Note: That sample program needs the Platform SDK's Iphlpapi.h and
Iphlpapi.lib file )


Thanks for your understanding!

newbie

unread,
Mar 15, 2006, 7:22:34 AM3/15/06
to
yes you can...
It is the same result...
WMI or MIB_IFROW.

""Gary Chang[MSFT]"" <v-ga...@online.microsoft.com> schreef in bericht
news:bp0pg0$RGHA...@TK2MSFTNGXA03.phx.gbl...

0 new messages