Struct ggrs::UdpNonBlockingSocket
source · pub struct UdpNonBlockingSocket { /* private fields */ }
Expand description
A simple non-blocking UDP socket tu use with GGRS Sessions. Listens to 0.0.0.0 on a given port.
Implementations§
source§impl UdpNonBlockingSocket
impl UdpNonBlockingSocket
sourcepub fn bind_to_port(port: u16) -> Result<Self, Error>
pub fn bind_to_port(port: u16) -> Result<Self, Error>
Binds an UDP Socket to 0.0.0.0:port and set it to non-blocking mode.
Trait Implementations§
source§impl Debug for UdpNonBlockingSocket
impl Debug for UdpNonBlockingSocket
source§impl NonBlockingSocket<SocketAddr> for UdpNonBlockingSocket
impl NonBlockingSocket<SocketAddr> for UdpNonBlockingSocket
source§fn send_to(&mut self, msg: &Message, addr: &SocketAddr)
fn send_to(&mut self, msg: &Message, addr: &SocketAddr)
Takes a
Message
and sends it to the given address.source§fn receive_all_messages(&mut self) -> Vec<(SocketAddr, Message)>
fn receive_all_messages(&mut self) -> Vec<(SocketAddr, 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.