コード例 #1
0
        protected override PacketObject OnReadPacket()
        {
            var packet = (PacketObject)null;

            do
            {
                if ((packets_busy_out_ == null) &&
                    (packets_list_.Count > 0)
                    )
                {
                    lock (packets_list_) {
                        packets_busy_out_ = packets_list_.Dequeue();
                    }
                }

                if (packets_busy_out_ != null)
                {
                    packet = SharpPcapParser.ParseAndBuild(packets_busy_out_.Dequeue(), option_parser_);

                    if (packets_busy_out_.Count == 0)
                    {
                        packets_busy_out_ = null;
                        packets_count_out_++;
                    }
                }
            } while (
                (packet == null) &&
                ((!ar_load_device_packet_.IsCompleted) ||
                 (packets_busy_out_ != null)
                ));

            return(packet);
        }
コード例 #2
0
 private void OnSharpPcapDev_OnPacketArrival(object sender, CaptureEventArgs e)
 {
     try {
         NotifyPcapPacket(SharpPcapParser.ParseAndBuild(e.Packet, parser_option_));
     } catch (Exception exp) {
         NotifyMessage(PacketPriority.Standard, "Ethernet", string.Format("Parse error.[{0}]", exp.Message));
     }
 }