Struct laminar::Socket [−][src]
pub struct Socket { /* fields omitted */ }
A reliable UDP socket implementation with configurable reliability and ordering guarantees.
Implementations
impl Socket
[src]
impl Socket
[src]pub fn bind<A: ToSocketAddrs>(addresses: A) -> Result<Self>
[src]
pub fn bind<A: ToSocketAddrs>(addresses: A) -> Result<Self>
[src]Binds to the socket and then sets up ActiveConnections
to manage the “connections”.
Because UDP connections are not persistent, we can only infer the status of the remote
endpoint by looking to see if they are still sending packets or not
pub fn bind_any_with_config(config: Config) -> Result<Self>
[src]
pub fn bind_any_with_config(config: Config) -> Result<Self>
[src]Binds to any local port on the system, if available, with a given config
pub fn bind_with_config<A: ToSocketAddrs>(
addresses: A,
config: Config
) -> Result<Self>
[src]
pub fn bind_with_config<A: ToSocketAddrs>(
addresses: A,
config: Config
) -> Result<Self>
[src]Binds to the socket and then sets up ActiveConnections
to manage the “connections”.
Because UDP connections are not persistent, we can only infer the status of the remote
endpoint by looking to see if they are still sending packets or not
This function allows you to configure laminar with the passed configuration.
pub fn get_packet_sender(&self) -> Sender<Packet>
[src]
pub fn get_packet_sender(&self) -> Sender<Packet>
[src]Returns a handle to the packet sender which provides a thread-safe way to enqueue packets to be processed. This should be used when the socket is busy running its polling loop in a separate thread.
pub fn get_event_receiver(&self) -> Receiver<SocketEvent>
[src]
pub fn get_event_receiver(&self) -> Receiver<SocketEvent>
[src]Returns a handle to the event receiver which provides a thread-safe way to retrieve events from the socket. This should be used when the socket is busy running its polling loop in a separate thread.
pub fn recv(&mut self) -> Option<SocketEvent>
[src]
pub fn recv(&mut self) -> Option<SocketEvent>
[src]Receives a single packet
pub fn start_polling(&mut self)
[src]
pub fn start_polling(&mut self)
[src]Runs the polling loop with the default ‘1ms’ sleep duration. This should run in a spawned thread
since calls to self.manual_poll
are blocking.
pub fn start_polling_with_duration(&mut self, sleep_duration: Option<Duration>)
[src]
pub fn start_polling_with_duration(&mut self, sleep_duration: Option<Duration>)
[src]Runs the polling loop with a specified sleep duration. This should run in a spawned thread
since calls to self.manual_poll
are blocking.
pub fn manual_poll(&mut self, time: Instant)
[src]
pub fn manual_poll(&mut self, time: Instant)
[src]Processes any inbound/outbound packets and handle idle clients
pub fn local_addr(&self) -> Result<SocketAddr>
[src]
pub fn local_addr(&self) -> Result<SocketAddr>
[src]Returns the local socket address
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Socket
impl Send for Socket
impl Sync for Socket
impl Unpin for Socket
impl UnwindSafe for Socket
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,