getstatistics/getstatistics.rs
1extern crate pcap;
2
3fn main() {
4 // get the default Device
5 let mut cap = pcap::Device::lookup().unwrap().open().unwrap();
6
7 // get 10 packets
8 for _ in 0..10 {
9 cap.next().ok();
10 }
11 let stats = cap.stats().unwrap();
12 println!("Received: {}, dropped: {}, if_dropped: {}", stats.received, stats.dropped, stats.if_dropped);
13}