ping

Function ping 

Source
pub async fn ping<T: TransportProtocol>(connection: T) -> IoResult
Expand description

Sends a ping request to ClamAV

This function establishes a connection to a ClamAV server and sends the PING command to it. If the server is available, it responds with PONG.

§Arguments

  • connection: The connection type to use - either TCP or a Unix socket connection

§Returns

An IoResult containing the server’s response as a vector of bytes

§Example

let clamd_tcp = clamav_client::async_std::Tcp{ host_address: "localhost:3310" };
let clamd_available = match clamav_client::async_std::ping(clamd_tcp).await {
    Ok(ping_response) => ping_response == clamav_client::PONG,
    Err(_) => false,
};