[Winpcap-users] Return from pcap_next_ex when there is a packet inthe buffer

Gianluca Varenni gianluca.varenni at cacetech.com
Wed Jul 13 15:00:42 GMT 2005


Hi Moshe.

Actually pcap_next_ex returns:

- if the timeout elapses
OR
- if "mintocopy" bytes are present in kernel buffer (whatever comes first).

Your app can be more responsive by
- lowering the timeout
- lowering the mintocopy value (with pcap_setmintocopy)

Remember that better responsiveness in receiving packets(= low timeouts and 
mintocopy) comes at the price of higher CPU loads, because there are many 
more ring transitions between kernel and user to retrieve packets out of the 
kernel buffer (in practice, more "read"s).

Hope it helps
GV



----- Original Message ----- 
From: "Moshe Shaked" <mshaked at qualcomm.com>
To: <winpcap-users at winpcap.org>
Sent: Tuesday, July 12, 2005 11:46 PM
Subject: [Winpcap-users] Return from pcap_next_ex when there is a packet 
inthe buffer


> Hi,
>
> Is there any way to instruct the winpcap lib to return from pcap_next_ex 
> function (or any other receive functions) immediately when it received a 
> packet
> and not wait until the timeout specified in pcap_open elapsed (what I mean 
> is like a WaitForSingleObject behavior)?
>
>
> Thanks in advance
> Moshe
>
> _______________________________________________
> 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