Expand description
craftping provides a ping
function to send Server List Ping requests to a Minecraft server.
§Feature flags
sync
(default): Enables synchronous, blockingping
function.async-tokio
: Enables asynchronous,tokio
-basedping
function.async-futures
: Enables asynchronous,futures
-basedping
function.
§Examples
use craftping::sync::ping;
use std::net::TcpStream;
fn main() {
let hostname = "my.server.com";
let port = 25565;
let mut stream = TcpStream::connect((hostname, port)).unwrap();
let response = ping(&mut stream, hostname, port).unwrap();
println!("Players online: {}", response.online_players);
}
Modules§
- Provides asynchronous
ping
function. (especially for futures-io compatible streams) - Provides synchronous, blocking
ping
function. - Provides asynchronous
ping
function. (especially for tokio streams)
Structs§
- The chat component used in the server description.
- The information of the channels used by the mods.
- The forge information object used in FML2 protocol (version 1.13 - current).
- The information of an installed mod.
- The mod information object used in FML protocol (version 1.7 - 1.12).
- The information of an installed mod.
- The sample players’ information.
- A ping response returned from server. The response schema can be altered anytime, thus
#[non_exhaustive]
.
Enums§
- The ping error type.
Type Aliases§
- The ping result type.