[][src]Struct facio::client::RconClient

pub struct RconClient { /* fields omitted */ }

The basic type to connect to a RCON server and execute commands.

It is certainly not safe to share this in concurrent applications. There should always be only one thread at a time which submits commands, etc.

Methods

impl RconClient[src]

pub fn exec<T: Into<String>>(&mut self, command: T) -> Result<String>[src]

Submits a command to the open RCON stream. Submit means, that it sends the package via stream, followed by the [control_packet], then waits for returning packets until a response packet with a packet id fitting the [control_packet] packet id is received.

All packets inbetween are considered to be an answer to the provided RawPacket and their values are combined into one string.

pub fn open<A: Into<String>, P: Into<String>, C: Into<String>>(
    addr: A,
    pass: P,
    safe_command: Option<C>,
    timeout: Option<Duration>
) -> Result<RconClient>
[src]

Opens up a connection to an RCON server by connection via TCP/IP and authenticated with provided pass.

A safe_command can be specified which needs to be a domain-specific RCON command for which it is guaranteed to receive exactly one packet as an answer, i.e. it needs to be a command which has an short answer.

If no safe_command is specified, the SERVERDATA_RESPONSE_VALUE trick is used, where after every command an empty SERVERDATA_RESPONSE_VALUE packet is sent to the server to trigger a RESPONSE_VALUE packet as a response and test for the end of command response. (See the section in this issue there.)

As a last parameter a timeout can be specified to let the function return with an error after a certain number of seconds while no connection can be established.

Auto Trait Implementations

impl Send for RconClient

impl Sync for RconClient

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]