[Winpcap-users] PacketReceivePacket is returning less thanMinToCopy bytes
Gianluca Varenni
gianluca.varenni at cacetech.com
Tue Mar 24 08:33:19 PDT 2009
----- Original Message -----
From: shrinivas balulad
To: winpcap-users at winpcap.org
Sent: Tuesday, March 24, 2009 3:53 AM
Subject: [Winpcap-users] PacketReceivePacket is returning less thanMinToCopy bytes
Hi all,
I am using winpcap 4.0.0.901.
I am trying to capture traffic @ 270mbps.
OS - WindowsXP
machine - Intel Core 2 Quad CPU 2.4GHz, 4GB RAM
NIC - Intel(R) 82566DC-2 Gigabit Network
for winpcap I have set PacketSetMinToCopy as 256k and PacketSetReadTimeout is 1 sec.
from mailing list and user manuals I learnt that PacketReceivePacket() should return if either of below conditions is met
- MinToCopy bytes have been copied
The problem is here: PacketReceivePackets returns when *at least* MinToCopy are available in the kernel buffer. If more than mintocopy bytes are available, then all the available packets are copied in the buffer passes to PacketReceivePackets.
- ReadTimeout expires
I am just checking lpPacket->ulBytesReceived after every read and I found that PacketReceivePacket() is returning bytes that ranges from 1k to more than 256k.
At 270mbps traffic, we can not expect ReadTimeout expiry. So only condition for PacketReceivePacket() to return is 'MinToCopy bytes have been copied'. But what I observed is only 1% of time it has returned 256k rest 99% of attempts have returned values ranging from 1k to more than 256k (2%). What I expect here is PacketReceivePacket() should return 256k in most cases @270mbps traffic as per above conditions.
And NIC stats show that OID_GEN_RCV_NO_BUFFER is zero and winpcap stats also say that no dropped frames.
Let me know whether my understanding of PacketReceivePacket is wrong? or In what conditions PacketReceivePacket() can return less than mintocopy bytes even though there is no readtimeout expiry?
It can be due to buffering, but I don't have a definitive answer to why you would receive less than mintocopy bytes. Why are you so concerned of receiving exactly 256k with each call to PacketReceivePackets?
Also, out of curiosity, why are you using the Packet API instead of the pcap one?
Have a nice day
GV
Thanks in advance for any help.
Regards,
Shrinivas
------------------------------------------------------------------------------
Add more friends to your messenger and enjoy! Invite them now.
------------------------------------------------------------------------------
_______________________________________________
Winpcap-users mailing list
Winpcap-users at winpcap.org
https://www.winpcap.org/mailman/listinfo/winpcap-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.winpcap.org/pipermail/winpcap-users/attachments/20090324/d509c932/attachment.htm
More information about the Winpcap-users
mailing list