/// <summary> /// Notify the OnPacketArrival delegates about a newly captured packet /// </summary> /// <param name="p"> /// A <see cref="RawCapture"/> /// </param> override protected void SendPacketArrivalEvent(RawCapture p) { if (Mode == CaptureMode.Packets) { base.SendPacketArrivalEvent(p); } else if (Mode == CaptureMode.Statistics) { OnPcapStatistics?.Invoke(this, new StatisticsModeEventArgs(p, this)); } }
private void LiveDevice_OnPacketArrival(object sender, CaptureEventArgs e) { if (IsWindows) { ReceivedPackets += BitConverter.ToInt64(e.Packet.Data, 0); ReceivedBytes += BitConverter.ToInt64(e.Packet.Data, 8); } else { ReceivedPackets++; ReceivedBytes += e.Packet.PacketLength; } var args = new StatisticsEventArgs( this, e.Packet.Timeval, ReceivedPackets, ReceivedBytes ); OnPcapStatistics?.Invoke(this, args); }