示例#1
0
        private void Start()
        {
            ICaptureDevice device = PacketDeviceSelector.AskForPacketDevice();

            device.OnPacketArrival += new PacketArrivalEventHandler(PacketHandler);
            device.Open(DeviceMode.Promiscuous, 1000);
            device.StartCapture();
        }
示例#2
0
        private void Start()
        {
            var device = PacketDeviceSelector.AskForPacketDevice();

            // var device = new OfflinePacketDevice("dump.pcap"); // Your wireshark dump (IT MUST BE *.pcap)

            using (PacketCommunicator communicator = device.Open(65536, PacketDeviceOpenAttributes.Promiscuous, 1000))
            {
                communicator.ReceivePackets(0, PacketHandler);
            }
        }