Luca,
Here you are: (the code is freepascal, so syntax might be little bit different
than you are used to)
PacketCaptureDescriptorPointer = pfring_open('eth5', 1, 60, 0);
pfring_enable_ring(PacketCaptureDescriptorPointer); //without this line I don't
get any packet
while (not Stop) do
if (pfring_recv(PacketCaptureDescriptorPointer, PacketArray, 0, @header, 0) >
0) then
...//get values from packet
I'm not using filters.
Best regards,
Tom
From: [email protected]
[mailto:[email protected]] On Behalf Of Luca Deri
Sent: donderdag 28 januari 2010 11:51
To: [email protected]
Subject: Re: [Ntop-misc] non-blocking pfring_recv
Hi Tom
On 01/28/2010 11:48 AM, Tom Carly wrote:
Luca,
In the mean time I tried with pfring_enable_ring and that seems to work as
well. The doc says not to use this. Is there a difference (performance?) with
using
Are you using filters? Can you post me the code fragments you use (I just need
the sequence of pfring_xxx) so I can understand why you need to call pfring
enable
pfring_get_selectable_fd?
No the performance is the same. Bear in mind than it's faster to actively wait
rather than poll()-ing
Cheers Luca
Thanks,
Tom
From:
[email protected]<mailto:[email protected]>
[mailto:[email protected]] On Behalf Of Luca Deri
Sent: donderdag 28 januari 2010 11:40
To: [email protected]<mailto:[email protected]>
Subject: Re: [Ntop-misc] non-blocking pfring_recv
On 01/26/2010 01:05 PM, Tom Carly wrote:
Hi,
I am trying to call pfring_recv with wait_for_incoming_packet = 0 because I
don't want my application to be blocked if no packets are arriving. Though, it
seems that I cannot longer receive packets doing that. The result of
pfring_recv is always smaller than 0. If I put the parameter to 1, I get all
packets.
Any idea what could be wrong?
Tom
if you don't like blocking, then set wait to 0 but do call
pfring_get_selectable_fd() obtain a file description and call a select or poll
in order to be notified when there are packets available
Cheers Luca
Thanks,
Tom Carly
________________________________
_______________________________________________
Ntop-misc mailing list
[email protected]<mailto:[email protected]>
http://listgateway.unipi.it/mailman/listinfo/ntop-misc
________________________________
_______________________________________________
Ntop-misc mailing list
[email protected]<mailto:[email protected]>
http://listgateway.unipi.it/mailman/listinfo/ntop-misc
_______________________________________________
Ntop-misc mailing list
[email protected]
http://listgateway.unipi.it/mailman/listinfo/ntop-misc