[Winpcap-users] Winpcap-users Digest, Vol 72, Issue 8

Gianluca Varenni Gianluca.Varenni at riverbed.com
Thu Mar 31 09:24:24 PDT 2011


There is always a wait, but it's performed in user mode (and not in the driver). So the driver doesn't need the timeout.

This is what happens:
1. packet.dll creates an unnamed event and passes the HANDLE to the driver
2. the driver is responsible for setting/resetting the event when packets are available or not
3. inside PacketReceivePacket, there is a WaitForSingleObject on that HANDLE (with a timeout)

Have a nice day
GV

-----Original Message-----
From: winpcap-users-bounces at winpcap.org [mailto:winpcap-users-bounces at winpcap.org] On Behalf Of "Fish" (David B. Trout)
Sent: Wednesday, March 30, 2011 7:07 PM
To: winpcap-users at winpcap.org
Subject: Re: [Winpcap-users] Winpcap-users Digest, Vol 72, Issue 8

Gianluca Varenni wrote:

> 1. The driver code is still there (because we never removed it) but 
> it's no longer used by Packet.dll. Timeouts are implemented in user 
> mode.

How?

How can user code wait for packets to arrive without an event to wait on?

Even if you plan on providing support for asynchronous (OVERLAPPED) i/o, there still has to be an event (such as the one in the OVERLAPPED struct) for the user code to wait on, since a "polling" read loop such as:

  for (;;)
  {
    ReadFile(... &dwBytesReceived, NULL);

    if (dwBytesReceived > 0)
      ProcessPackets();
  }

is too inefficient and would consume too much CPU for very small (e.g. zero) SetMinToCopy values.

One way or another there needs to be an event the user code can wait on that gets signaled whenever packets arrive, Gianluca.

Or am I missing something?

--
"Fish" (David B. Trout)
 fish at softdevlabs.com




_______________________________________________
Winpcap-users mailing list
Winpcap-users at winpcap.org
https://www.winpcap.org/mailman/listinfo/winpcap-users


More information about the Winpcap-users mailing list