pub struct SyncSoeSocket { /* private fields */ }Expand description
A synchronous SOE socket: a SoeMultiplexer driven over a blocking
std::net::UdpSocket.
Drive it by repeatedly calling step, which performs a
single read-or-tick cycle and returns any SocketEvents produced. The socket
is given a read timeout equal to the tick period, so step returns promptly when
a datagram arrives and otherwise wakes once per tick to run housekeeping.
Implementations§
Source§impl SyncSoeSocket
impl SyncSoeSocket
Sourcepub fn bind(
local: SocketAddr,
config: SocketConfig,
tick_period: Duration,
) -> Result<Self>
pub fn bind( local: SocketAddr, config: SocketConfig, tick_period: Duration, ) -> Result<Self>
Binds a UDP socket to local and prepares to drive sessions, waking at least
once every tick_period to run housekeeping. A period of 1–10ms is typical.
Sourcepub fn step(&mut self) -> Result<Vec<SocketEvent<SocketAddr>>>
pub fn step(&mut self) -> Result<Vec<SocketEvent<SocketAddr>>>
Performs a single drive cycle: waits up to the tick period for an incoming datagram, runs a session tick, flushes outgoing datagrams, and returns any events.
Trait Implementations§
Source§impl Debug for SyncSoeSocket
impl Debug for SyncSoeSocket
Source§impl SoeSocket for SyncSoeSocket
impl SoeSocket for SyncSoeSocket
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 SyncSoeSocket
impl RefUnwindSafe for SyncSoeSocket
impl Send for SyncSoeSocket
impl Sync for SyncSoeSocket
impl Unpin for SyncSoeSocket
impl UnsafeUnpin for SyncSoeSocket
impl UnwindSafe for SyncSoeSocket
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