Struct netcode::Client
[−]
[src]
pub struct Client<I, S> where
I: SocketProvider<I, S>, { /* fields omitted */ }
Netcode client object.
Methods
impl<I, S> Client<I, S> where
I: SocketProvider<I, S>,
[src]
I: SocketProvider<I, S>,
fn new(token: &ConnectToken) -> Result<Client<I, S>, SendError>
Constructs a new client from an existing ConnectToken
.
fn update(&mut self, elapsed: f64)
Updates time elapsed since last client iteration.
fn next_event(
&mut self,
payload: &mut [u8; 1175]
) -> Result<Option<ClientEvent>, UpdateError>
&mut self,
payload: &mut [u8; 1175]
) -> Result<Option<ClientEvent>, UpdateError>
Checks for incoming packets and state changes. Returns None
when no more events
are pending.
fn send(&mut self, payload: &[u8]) -> Result<usize, SendError>
Sends a packet to connected server.
fn disconnect(&mut self) -> Result<(), SendError>
fn get_state(&self) -> State
Gets the current state of our client.