Function mc_query::query::stat_full

source ·
pub async fn stat_full(host: &str, port: u16) -> Result<FullStatResponse>
Expand description

Perform a full stat query of the server per the Query Protocol. Note that the server must have query-enabled=true set in its properties to get a response. The query.port property might also be different from server.port.

Arguments

  • host - the hostname/IP of thr server to query
  • port - the port that the server’s Query is running on

Examples

use mc_query::query;
use tokio::io::Result;

#[tokio::main]
async fn main() -> Result<()> {
    let res = query::stat_full("localhost", 25565).await?;
    println!("The server has {} players online out of {}", res.num_players, res.num_players);

    Ok(())
}