pub async fn status(host: &str, port: u16) -> Result<StatusResponse>
Expand description
Ping the server for information following the Server List Ping protocol.
§Arguments
host
- A string slice that holds the hostname of the server to connect to.port
- The port to connect to on that server.
§Errors
Returns Err
if there was a network issue or the server sent invalid data.
§Examples
use mc_query::status;
use tokio::io::Result;
#[tokio::main]
async fn main() -> Result<()> {
let data = status("mc.hypixel.net", 25565).await?;
println!("{data:#?}");
Ok(())
}