pub async fn stat_basic(host: &str, port: u16) -> Result<BasicStatResponse>Expand description
Perform a basic 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 queryport- the port that the server’s Query is running on
§Errors
Will return Err if there was a network error, if the challenge token wasn’t obtainable, or if
invalid data was recieved.
§Examples
use mc_query::query;
use tokio::io::Result;
#[tokio::main]
async fn main() -> Result<()> {
let res = query::stat_basic("localhost", 25565).await?;
println!("The server has {} players online out of {}", res.num_players, res.num_players);
Ok(())
}