pub trait VirtualConnectedSocket: VirtualSocket + Debug + Send + Sync + 'static {
    // Required methods
    fn set_linger(&mut self, linger: Option<Duration>) -> Result<()>;
    fn linger(&self) -> Result<Option<Duration>>;
    fn try_send(&mut self, data: &[u8]) -> Result<usize>;
    fn poll_send(
        &mut self,
        cx: &mut Context<'_>,
        data: &[u8]
    ) -> Poll<Result<usize>>;
    fn poll_flush(&mut self, cx: &mut Context<'_>) -> Poll<Result<()>>;
    fn close(&mut self) -> Result<()>;
    fn poll_recv(
        &mut self,
        cx: &mut Context<'_>,
        buf: &mut [MaybeUninit<u8>]
    ) -> Poll<Result<usize>>;
    fn try_recv(&mut self, buf: &mut [MaybeUninit<u8>]) -> Result<usize>;
}
Expand description

Connected sockets have a persistent connection to a remote peer

Required Methods§

source

fn set_linger(&mut self, linger: Option<Duration>) -> Result<()>

Determines how long the socket will remain in a TIME_WAIT after it disconnects (only the one that initiates the close will be in a TIME_WAIT state thus the clients should always do this rather than the server)

source

fn linger(&self) -> Result<Option<Duration>>

Returns how long the socket will remain in a TIME_WAIT after it disconnects

source

fn try_send(&mut self, data: &[u8]) -> Result<usize>

Tries to send out a datagram or stream of bytes on this socket

source

fn poll_send( &mut self, cx: &mut Context<'_>, data: &[u8] ) -> Poll<Result<usize>>

Sends out a datagram or stream of bytes on this socket

source

fn poll_flush(&mut self, cx: &mut Context<'_>) -> Poll<Result<()>>

Attempts to flush the object, ensuring that any buffered data reach their destination.

source

fn close(&mut self) -> Result<()>

Closes the socket

source

fn poll_recv( &mut self, cx: &mut Context<'_>, buf: &mut [MaybeUninit<u8>] ) -> Poll<Result<usize>>

Recv a packet from the socket

source

fn try_recv(&mut self, buf: &mut [MaybeUninit<u8>]) -> Result<usize>

Recv a packet from the socket

Implementors§