private void ReadNextLoop() { PcapHeader packetHeader; System.Byte[] arr; IntPtr i, i1; PCAP_NEXT_EX_STATE pcap_next_ex_state; while (true) { packetHeader = null; arr = null; pcap_next_ex_state = ReadNextInternal(out packetHeader, out arr, out i, out i1); if (pcap_next_ex_state == PCAP_NEXT_EX_STATE.SUCCESS) { if (PacketArrival != null) { PacketArrival.Invoke(this, packetHeader, arr); } } } }
protected virtual void OnPacketArrival(PacketArrivedEventArgs e) { PacketArrival?.Invoke(this, e); }
public event PacketArrivedEventHandler PacketArrival;//声明时间句柄函数 private void OnPacketArrival(PacketArrivedEventArgs e) { PacketArrival?.Invoke(this, e);//触发事件 }
protected virtual void OnPacketArrival(Packet packet) { PacketArrival?.Invoke(this, packet); }