[Winpcap-users] How does windows see that the NIC has received data?

Guy Harris guy at alum.mit.edu
Wed Mar 15 21:14:07 GMT 2006


Ramiro Polla wrote:
> I was wondering... Is it absolutely necessary for winpcap to keep 
> checking the status of the NIC to see if there is any data?
> Doesn't the NIC call some interrupt when it receives data. And that 
> interrupt could be used to call the callback function.
> 
> If it really is absolutely necessary to constantly check the NIC, how 
> does windows do it, and couldn't a function be made to call the callback 
> function at every packet received? (without the user having to ask every 
> time).

WinPcap's implementing a BPF-style scheme, in which:

	1) packets can be buffered, so that, instead of a wakeup and packet 
copy occuring on every packet, multiple packets can be delivered per wakeup;

	2) a timeout is used so that it doesn't have to wait indefinitely for 
enough packets to arrive before supplying the packets to the application;

	3) the timer starts when the read is done, not when the first packet 
arrives.

3) is the reason why your application doesn't block forever waiting for 
a packet; it has nothing to do with the way WinPcap interacts with the 
NIC (which it does through NDIS).


More information about the Winpcap-users mailing list