Struct surge_ping::Pinger [−][src]
pub struct Pinger { /* fields omitted */ }
Expand description
A Ping struct represents the state of one particular ping instance.
Examples
use std::time::Duration;
use surge_ping::Pinger;
#[tokio::main]
async fn main() {
let mut pinger = Pinger::new("114.114.114.114".parse().unwrap()).unwrap();
pinger.size(56).timeout(Duration::from_secs(1));
let result = pinger.ping(0).await;
println!("{:?}", result);
}
Implementations
Sets the value for the SO_BINDTODEVICE
option on this socket.
If a socket is bound to an interface, only packets received from that
particular interface are processed by the socket. Note that this only
works for some socket types, particularly AF_INET
sockets.
If interface
is None
or an empty string it removes the binding.
This function is only available on Fuchsia and Linux.
Binds this socket to the specified address. This function directly corresponds to the bind(2) function on Windows and Unix.
Set the value of the IP_TTL option for this socket. This value sets the time-to-live field that is used in every packet sent from this socket.
The timeout of each Ping, in seconds. (default: 2s)
Send Ping request with sequence number.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Pinger
impl !UnwindSafe for Pinger
Blanket Implementations
Mutably borrows from an owned value. Read more