Skip to main content

SyncSoeSocket

Struct SyncSoeSocket 

Source
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

Source

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.

Source

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

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl SoeSocket for SyncSoeSocket

Source§

fn local_addr(&self) -> Result<SocketAddr>

Returns the local address the underlying socket is bound to.
Source§

fn session_count(&self) -> usize

Returns the number of active sessions.
Source§

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

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)

Terminates the session with remote, notifying the remote party.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.