virtual_net

Trait VirtualConnectionlessSocket

Source
pub trait VirtualConnectionlessSocket:
    VirtualSocket
    + Debug
    + Send
    + Sync
    + 'static {
    // Required methods
    fn try_send_to(&mut self, data: &[u8], addr: SocketAddr) -> Result<usize>;
    fn try_recv_from(
        &mut self,
        buf: &mut [MaybeUninit<u8>],
    ) -> Result<(usize, SocketAddr)>;
}
Expand description

Connectionless sockets are able to send and receive datagrams and stream bytes to multiple addresses at the same time (peer-to-peer)

Required Methods§

Source

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

Sends out a datagram or stream of bytes on this socket to a specific address

Source

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

Recv a packet from the socket

Implementors§

Source§

impl VirtualConnectionlessSocket for LocalUdpSocket

Available on crate feature host-net only.