Вопрос

I am trying to get SharpPcap Statistics to work, but the OnPcapStatistics event never fires.

Here's the code: SharpPcap Example 11: statistics

Code project article: SharpPcap: Statistics

Does anyone know why?

Это было полезно?

Решение

You just found a bug!

WinPcapDevice was creating a new SendPacketArrivalEvent() instead of overriding it. Modified PcapDevice.SendPacketArrivalEvent() to be a virtual and WinPcapDevice.SendPacketArrivalEvent() to be an override and now the correct method is called.

The issue was that because WinPcapDevice was creating a new method instead of overriding it that PcapDevice was capturing a packet and calling its own SendPacketArrivalEvent(). This implementation doesn't handle statistics events as they are specific to WinPcapDevices.

Fixed the issue, updated the assembly info to 4.0.1 and uploaded the assembly to filedropper:

http://www.filedropper.com/sharppcap

If you could try that and see that it works I'll check the fix into git and it will go out with the next release of SharpPcap.

Thanks again for the bug report.

Chris

Author of SharpPcap

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top