Ejemplo n.º 1
0
 public void StopAll()
 {
     foreach (PcapDevice device in NetWorkController.GetList())
     {
         try
         {
             if (device.PcapOpened)
             {
                 device.PcapStopCapture();
             }
         }
         catch { }
     }
 }
Ejemplo n.º 2
0
 public void Listen()
 {
     Task.Factory.StartNew(() =>
     {
         ////遍历网卡
         foreach (PcapDevice device in NetWorkController.GetList())
         {
             ////分别启动监听,指定包的处理函数
             device.PcapOnPacketArrival += device_OnPacketArrival;
             device.PcapOpen(true, 1000);
             device.PcapStartCapture();
         }
     });
 }