[Winpcap-users] WINPCAP issue with Microsoft C# (VS 2005)

Chris Boebel cboebel at gmail.com
Sun Apr 9 14:35:55 GMT 2006


Greetings -

I have encountered a problem using winpcap 3.1 from Microsoft's C# (Visual
Sutdio 2005).

I have seen the issue reported on the web, but after much searching I have
not found an answer. Hopefully, someone here will know.

Essentailly, the callback function is called properly for the first packet.
When it is called for the second packet, some strange behaviour can be seen.
First, caplen in the header structure is set to the timeout value set when
calling pcap_open_live. len is set to zero. Additionally, the data pointer
comes back with the number of packets to capture (sent to pcap_dispatch).

For example, if pcap_open_live is called with a timeout value of 5000,
caplen comes back as 5000. If pcap_dispatch is called with the number of
packets as 10, the pointer to the data comes back as equal to 10.

Looking at the pcap structure, I'm wondering if something is messing with
the data contained therein between the first and second calls to the
callback function.

Any thoughts? I would be much obliged.

I should point out that using pcap_next_ex instead of dispatch or loop works
just fine. Being that pcap_next_ex is just a wrapper for dispatch, it must
be something that C# is doing.

Thank you
Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.winpcap.org/pipermail/winpcap-users/attachments/20060409/991be4a8/attachment.htm


More information about the Winpcap-users mailing list