hcap 0.0.2

A packet capture API around pcap/wpcap
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
extern crate pcap;

fn main() {
    // get the default Device
    let mut cap = pcap::Device::lookup().unwrap().open().unwrap();

    // get 10 packets
    for _ in 0..10 {
      cap.next().ok();
    }
    let stats = cap.stats().unwrap();
    println!("Received: {}, dropped: {}, if_dropped: {}", stats.received, stats.dropped, stats.if_dropped);
}