tokio-ping is an asynchronous ICMP pinging library.
Note, sending and receiving ICMP packets requires privileges.
```rust extern crate futures; extern crate tokiocore; extern crate tokioping;
use futures::Stream;
fn main() { let addr = std::env::args().nth(1).unwrap().parse().unwrap();
let mut reactor = tokio_core::reactor::Core::new().unwrap();
let pinger = tokio_ping::Pinger::new(&reactor.handle()).unwrap();
let stream = pinger.chain(addr).stream();
let future = stream.take(3).for_each(|mb_time| {
match mb_time {
Some(time) => println!("time={}", time),
None => println!("timeout"),
}
Ok(())
});
reactor.run(future).unwrap_or_default();
}
```
This project is licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in Serde by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.