Trait dhcp_client_core::deps::Socket
source · 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§
sourceasync fn send_to(&self, buf: &[u8], addr: T) -> Result<(), SocketError>
async fn send_to(&self, buf: &[u8], addr: T) -> Result<(), SocketError>
Sends a datagram containing the contents of buf
to addr
.
sourceasync fn recv_from(
&self,
buf: &mut [u8],
) -> Result<DatagramInfo<T>, SocketError>
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.