[][src]Struct victorem::ClientSocket

pub struct ClientSocket { /* fields omitted */ }

Client used to communicate with GameServer. Must be singleton in your app.

Methods

impl ClientSocket
[src]

pub fn new(
    port: u16,
    server_address: impl ToSocketAddrs
) -> Result<ClientSocket, Exception>
[src]

Create new client and listen on port to recv packets from server_address and send its to them.

pub fn send(&mut self, command: Vec<u8>) -> Result<usize, Exception>
[src]

Send data to server Don't block current thread may wait up to 30 milliseconds if you send commands too often Commands ordered and with some guarantees.

pub fn recv(&mut self) -> Result<Vec<u8>, Exception>
[src]

Reads data from server. Don't block current thread. Return Exception with std::io::ErrorKind::WouldBlock if there is no data available. Data ordered and without some guarantees.

Auto Trait Implementations

Blanket Implementations

impl<T> From for T
[src]

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

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

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

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

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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