Trait ggrs::NonBlockingSocket

source ·
pub trait NonBlockingSocket<A>
where A: Clone + PartialEq + Eq + Hash,
{ // Required methods fn send_to(&mut self, msg: &Message, addr: &A); fn receive_all_messages(&mut self) -> Vec<(A, Message)>; }
Expand description

This NonBlockingSocket trait is used when you want to use GGRS with your own socket. However you wish to send and receive messages, it should be implemented through these two methods. Messages should be sent in an UDP-like fashion, unordered and unreliable. GGRS has an internal protocol on top of this to make sure all important information is sent and received.

Required Methods§

source

fn send_to(&mut self, msg: &Message, addr: &A)

Takes a Message and sends it to the given address.

source

fn receive_all_messages(&mut self) -> Vec<(A, Message)>

This method should return all messages received since the last time this method was called. The pairs (A, Message) indicate from which address each packet was received.

Implementors§