Struct rercon::Connection [−][src]
pub struct Connection { /* fields omitted */ }
Expand description
Represents a single-established RCON connection to the server, which will not automatically reconnect once the connection has failed.
This struct will instead opt to return IO errors
, leaving connection responsibility in the callers hands.
Example
use rercon::{Connection, Settings};
#[tokio::main]
async fn main() {
let mut connection = Connection::open("123.456.789.123:27020", "my_secret_password", Settings::default()).await.unwrap();
let reply = connection.exec("hello").await.unwrap();
println!("Reply from server: {}", reply);
}
Implementations
Opens a new RCON connection, with an optional timeout, and authenticates the connection to the remote server. If connect_timeout is set to None, a default timeout of 10 seconds will be used.
Sends a command to the RCON server, returning the combined reply (in case there are multiple packets) or an error.