SharpPcap OnPcapStatistics event never fires?

最后都变了- 提交于 2019-12-08 11:58:13

问题


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?


回答1:


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



来源:https://stackoverflow.com/questions/7458542/sharppcap-onpcapstatistics-event-never-fires

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!