Expand description

tokio-icmp-echo is an asynchronous ICMP pinging library.

The repository is located at https://github.com/jcgruenhage/tokio-icmp-echo/.

Usage example

Note, sending and receiving ICMP packets requires privileges.

use futures::{future, StreamExt};

async fn main() {
    let addr = std::env::args().nth(1).unwrap().parse().unwrap();

    let pinger = tokio_icmp_echo::Pinger::new().await.unwrap();
    let stream = pinger.chain(addr).stream();
    stream.take(3).for_each(|mb_time| {
        match mb_time {
            Ok(Some(time)) => println!("time={:?}", time),
            Ok(None) => println!("timeout"),
            Err(err) => println!("error: {:?}", err)


Ping the same host several times.

Stream of sequential ping response times, iterates None if timed out.

Represent a future that resolves into ping response time, resolves into None if timed out.

ICMP packets sender and receiver.