pub trait VirtualConnectionlessSocket: VirtualSocket + Debug + Send + Sync + 'static {
// Required methods
fn poll_send_to(
&mut self,
cx: &mut Context<'_>,
data: &[u8],
addr: SocketAddr
) -> Poll<Result<usize>>;
fn try_send_to(&mut self, data: &[u8], addr: SocketAddr) -> Result<usize>;
fn poll_recv_from<'a>(
&mut self,
cx: &mut Context<'_>,
buf: &'a mut [MaybeUninit<u8>]
) -> Poll<Result<(usize, SocketAddr)>>;
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 poll_send_to(
&mut self,
cx: &mut Context<'_>,
data: &[u8],
addr: SocketAddr
) -> Poll<Result<usize>>
fn poll_send_to( &mut self, cx: &mut Context<'_>, data: &[u8], addr: SocketAddr ) -> Poll<Result<usize>>
Sends out a datagram or stream of bytes on this socket to a specific address
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 poll_recv_from<'a>(
&mut self,
cx: &mut Context<'_>,
buf: &'a mut [MaybeUninit<u8>]
) -> Poll<Result<(usize, SocketAddr)>>
fn poll_recv_from<'a>( &mut self, cx: &mut Context<'_>, buf: &'a mut [MaybeUninit<u8>] ) -> Poll<Result<(usize, SocketAddr)>>
Recv a packet from the socket
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