Skip to main content

SoeSocket

Trait SoeSocket 

Source
pub trait SoeSocket {
    // Required methods
    fn local_addr(&self) -> Result<SocketAddr>;
    fn session_count(&self) -> usize;
    fn connect(&mut self, remote: SocketAddr);
    fn enqueue_data(&mut self, remote: &SocketAddr, data: &[u8]) -> bool;
    fn terminate(&mut self, remote: &SocketAddr, reason: DisconnectReason);
}
Expand description

A driver-agnostic surface for managing SOE sessions over a UDP socket.

Implemented by the concrete socket drivers — crate::sync_rt::SyncSoeSocket and (with the tokio feature) TokioSoeSocket — so that application code can be written generically over the driver.

The I/O drive step itself differs between drivers (a blocking step versus an async fn step) and so is provided as an inherent method on each type rather than on this trait.

Required Methods§

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.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§