PacketSniffer
This
sample demonstrates the basic usage of listening modes. It sets
chosen network interface into the listening mode (sent and received
packets queued) and polls helper driver for new packets. Starting
from version 2.0 of WinpkFilter this sample is also demonstrates
the usage of promiscuous mode.
Notes:
- If you set adapter
into the listening mode you should remember that the internal
helper driver packet queue size is limited (500 packets in current
version). If you don't read packets from the queue (with
CNdisApi::ReadPacket) or release the queued packets directly by
calling CNdisApi::FlushAdapterPacketQueue then after the queue
reaches it's maximum limit all network activities will be frozen.
Please be attentive, don't forget to release network interface
after you have finished reading packets from it (see
ReleaseInterface function in the PacketSniffer.cpp).
- Use ListAdapters for
getting information about MSTCP network interfaces and for getting
network interface index for calling PacketSniffer
- Note that as far as
network interfaces can be enabled/disabled dynamically on Windows
2000/XP adapter list also changes when these operations
performed.
- PacketSniffer uses
polling helper driver for packets. This is not effective and has a
serious performance impact. Take a look on the more advanced
PassThru for more effective approach
with Win32 event.
|