Expand description
winping - Easy ICMP Echo for Windows, and no elevated rights required!
Published on crates.io as winping-rs, a maintained fork of the winping crate and a drop-in
replacement for it. The library target keeps the name winping, so use winping::... works
unchanged.
Super basic ping.exe example
use std::net::IpAddr;
use winping::{Buffer, Pinger};
fn main() {
let dst = std::env::args()
.nth(1)
.unwrap_or(String::from("127.0.0.1"))
.parse::<IpAddr>()
.expect("Could not parse IP Address");
let pinger = Pinger::new().unwrap();
let mut buffer = Buffer::new();
for _ in 0..4 {
match pinger.send(dst, &mut buffer) {
Ok(rtt) => println!("Response time {} ms.", rtt),
Err(err) => println!("{}.", err),
}
}
}Structs§
- Async
Pinger - A pinger that does not block when sending.
- Async
Result - The result of an async ping, together with the buffer that was passed in.
- Buffer
- A buffer for request and reply data.
- Ping
Future - The immediate return value of an AsyncPinger. You should probably just use async/await syntax instead.
- Pinger
- A pinger that blocks when sending.
Enums§
- Create
Error - An error when creating a Pinger.
- Error
- An error when sending a ping request.
- IpPair
- A pair of IP (v4 or v6) addresses, source and destination.
Functions§
- set_
async_ buffer_ size - Sets the size of the channel used to send ping requests to the async IO
thread described in
AsyncPinger::new.