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§
sourcefn try_send_to(&mut self, data: &[u8], addr: SocketAddr) -> Result<usize>
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
sourcefn try_recv_from(
&mut self,
buf: &mut [MaybeUninit<u8>],
) -> Result<(usize, SocketAddr)>
fn try_recv_from( &mut self, buf: &mut [MaybeUninit<u8>], ) -> Result<(usize, SocketAddr)>
Recv a packet from the socket
Implementors§
impl VirtualConnectionlessSocket for LocalUdpSocket
Available on crate feature
host-net
only.