pub trait Socket<T> {
    // Required methods
    async fn send_to(&self, buf: &[u8], addr: T) -> Result<(), SocketError>;
    async fn recv_from(
        &self,
        buf: &mut [u8]
    ) -> Result<DatagramInfo<T>, SocketError>;
}
Expand description

Abstracts sending and receiving datagrams on a socket.

Required Methods§

source

async fn send_to(&self, buf: &[u8], addr: T) -> Result<(), SocketError>

Sends a datagram containing the contents of buf to addr.

source

async fn recv_from( &self, buf: &mut [u8] ) -> Result<DatagramInfo<T>, SocketError>

Receives a datagram into buf, returning the number of bytes received and the address the datagram was received from.

Object Safety§

This trait is not object safe.

Implementors§