pub struct TokioSoeSocket { /* private fields */ }Expand description
An async SOE socket: a SoeMultiplexer driven over a Tokio UDP socket.
Drive it by repeatedly awaiting step, which performs a
single read-or-tick cycle and returns any SocketEvents produced. Sessions are
initiated with connect and data is sent with
enqueue_data.
Implementations§
Source§impl TokioSoeSocket
impl TokioSoeSocket
Sourcepub async fn bind(
local: SocketAddr,
config: SocketConfig,
tick_period: Duration,
) -> Result<Self>
pub async fn bind( local: SocketAddr, config: SocketConfig, tick_period: Duration, ) -> Result<Self>
Binds a UDP socket to local and prepares to drive sessions, ticking every
tick_period. A period of 1–10ms is typical.
Sourcepub fn local_addr(&self) -> Result<SocketAddr>
pub fn local_addr(&self) -> Result<SocketAddr>
Returns the local address the socket is bound to.
Sourcepub async fn step(&mut self) -> Result<Vec<SocketEvent<SocketAddr>>>
pub async fn step(&mut self) -> Result<Vec<SocketEvent<SocketAddr>>>
Performs a single drive cycle: awaits either an incoming datagram or the next tick, runs a session tick, flushes outgoing datagrams, and returns any events.
Trait Implementations§
Source§impl Debug for TokioSoeSocket
impl Debug for TokioSoeSocket
Source§impl SoeSocket for TokioSoeSocket
impl SoeSocket for TokioSoeSocket
Source§fn local_addr(&self) -> Result<SocketAddr>
fn local_addr(&self) -> Result<SocketAddr>
Returns the local address the underlying socket is bound to.
Source§fn session_count(&self) -> usize
fn session_count(&self) -> usize
Returns the number of active sessions.
Source§fn connect(&mut self, remote: SocketAddr)
fn connect(&mut self, remote: SocketAddr)
Opens a client session to
remote. The session request is sent on the next
drive step.Source§fn enqueue_data(&mut self, remote: &SocketAddr, data: &[u8]) -> bool
fn enqueue_data(&mut self, remote: &SocketAddr, data: &[u8]) -> bool
Enqueues application data to be sent reliably to
remote. Returns false if
there is no running session for that address.Source§fn terminate(&mut self, remote: &SocketAddr, reason: DisconnectReason)
fn terminate(&mut self, remote: &SocketAddr, reason: DisconnectReason)
Terminates the session with
remote, notifying the remote party.Auto Trait Implementations§
impl !Freeze for TokioSoeSocket
impl !RefUnwindSafe for TokioSoeSocket
impl !UnwindSafe for TokioSoeSocket
impl Send for TokioSoeSocket
impl Sync for TokioSoeSocket
impl Unpin for TokioSoeSocket
impl UnsafeUnpin for TokioSoeSocket
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more