[Winpcap-users] Problem capturing packets without timeout
Gianluca Varenni
gianluca.varenni at cacetech.com
Wed Nov 16 16:03:28 GMT 2005
Hi.
The problem is that a timeout of 0 means "infinite timeout", *and* so your
app will be awakened only when a "fair" amount of bytes have been received
by the driver. By "fair amount" I mean the "mintocopy" parameter of the
WinPcap driver, that can be set with pcap_setmintocopy
(http://www.winpcap.org/docs/docs31/html/group__wpcapfunc.html#ga49).
I think that you seem not to receive any packet just because you didn't
received enough data (less than mintocopy) to wake up your app.
Remember that setting a small mintocopy improves your application
responsiveness, but it can badly affect the CPU load (due to the larger
number of system calls needed to bring the packets to user level).
Hope it helps.
GV
----- Original Message -----
From: <MARCELOT at terra.es>
To: <winpcap-users at winpcap.org>
Sent: Monday, November 14, 2005 9:07 AM
Subject: [Winpcap-users] Problem capturing packets without timeout
> Hi all:
>
> I'm trying to capture packets without time-out, in other
> words, I like to receive the packet as soon as it is received. When I
> use pcap_open with timeout it works well, but with time-out. When I use
> pcap_open with timeout 0 and after that pcap_next_ex, I don't receive
> any packet.
> I use:
> adhandle= pcap_open(d->name,65536,0,0,NULL,errbuf);
> res=pcap_next_ex (adhandle,&header,(const unsigned char **)
> (&pkt_data));
> But it doesn't work. What i'm doing bad ?
> Thanks in
> advance
> Marcelo.
>
>
>
> _______________________________________________
> 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